Trait godot::prelude::GodotClass
pub trait GodotClass: Bounds + 'static + 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>() -> bool
where U: 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.
Required Associated Types§
type Base: GodotClass
type Base: GodotClass
The immediate superclass of T
. This is always a Godot engine class.
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 Methods§
fn 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§
fn inherits<U>() -> boolwhere
U: GodotClass,
fn inherits<U>() -> boolwhere
U: GodotClass,
Returns whether Self
inherits from U
.
This is reflexive, i.e Self
inherits from itself.
See also Inherits
for a trait bound.