Trait GodotClass
pub trait GodotClass:
Bounds
+ 'static
+ Sized {
type Base: GodotClass;
const INIT_LEVEL: InitLevel = <Self::Base as GodotClass>::INIT_LEVEL;
// Required method
fn class_id() -> ClassId;
// Provided methods
fn class_name() -> ClassId { ... }
fn inherits<Base>() -> bool
where Base: GodotClass { ... }
}
Expand description
Makes T
eligible to be managed by Godot and stored in Gd<T>
pointers.
The behavior of types implementing this trait is influenced by the associated types; check their documentation for information.
Normally, you don’t need to implement this trait yourself; use #[derive(GodotClass)]
instead.
Provided Associated Constants§
const INIT_LEVEL: InitLevel = <Self::Base as GodotClass>::INIT_LEVEL
const INIT_LEVEL: InitLevel = <Self::Base as GodotClass>::INIT_LEVEL
Initialization level, during which this class should be initialized with Godot.
The default is a good choice in most cases; override only if you have very specific initialization requirements.
It must not be less than Base::INIT_LEVEL
.
Required Associated Types§
type Base: GodotClass
type Base: GodotClass
The immediate superclass of T
. This is always a Godot engine class.
Required Methods§
Provided Methods§
fn class_name() -> ClassId
class_id()
fn inherits<Base>() -> boolwhere
Base: GodotClass,
fn inherits<Base>() -> boolwhere
Base: GodotClass,
Returns whether Self
inherits from Base
.
This is reflexive, i.e Self
inherits from itself.
See also Inherits
for a trait bound.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.