pub trait GodotClass: Bounds + 'staticwhere
Self: Sized,{
type Base: GodotClass;
const INIT_LEVEL: InitLevel = <Self::Base as GodotClass>::INIT_LEVEL;
// Required method
fn class_name() -> ClassName;
// Provided method
fn inherits<U: GodotClass>() -> bool { ... }
}
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§
Sourceconst 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§
Sourcetype Base: GodotClass
type Base: GodotClass
The immediate superclass of T
. This is always a Godot engine class.
Required Methods§
Sourcefn class_name() -> ClassName
fn class_name() -> ClassName
The name of the class, under which it is registered in Godot.
This may deviate from the Rust struct name: HttpRequest::class_name().as_str() == "HTTPRequest"
.
Provided Methods§
Sourcefn inherits<U: GodotClass>() -> bool
fn inherits<U: GodotClass>() -> bool
Returns whether Self
inherits from U
.
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.