Expand description
Different ways how bounds of a GodotClass can be checked.
This module contains multiple traits that can be used to check the characteristics of a GodotClass type:
-
Declarertells you whether the class is provided by the engine or user-defined.DeclEngineis used for all classes provided by the engine (e.g.Node3D).DeclUseris used for all classes defined by the user, typically through#[derive(GodotClass)].
-
Memoryis used to check the memory strategy of the static type.This is useful when you operate on associated functions of
Gd<T>orT, e.g. for construction.MemRefCountedis used forRefCountedclasses and derived.MemManualis used forObjectand all inherited classes, which are notRefCounted(e.g.Node).
§Example
Declare a custom smart pointer which wraps Gd<T> pointers, but only accepts T objects that are manually managed.
use godot::prelude::*;
use godot::obj::{bounds, Bounds};
struct MyGd<T>
where T: GodotClass + Bounds<Memory = bounds::MemManual>
{
inner: Gd<T>,
}Macros§
- Implements
Boundsfor a user-defined class.
Structs§
- No memory management, user responsible for not leaking. This is used for all
Objectderivates, which are notRefCounted.Objectitself is also excluded. - Memory managed through Godot reference counter (always present). This is used for
RefCountedclasses and derived.
Enums§
- Expresses that a class is declared by the Godot engine.
- Expresses that a class is declared by the user.
Traits§
- Trait that specifies who declares a given
GodotClass. - Specifies the memory strategy of the static type.