Trait GodotConvert
pub trait GodotConvert {
type Via: GodotType;
// Required method
fn godot_shape() -> GodotShape;
}Expand description
Indicates that a type can be passed to/from Godot, either directly or through an intermediate “via” type.
The associated type Via specifies how this type is passed across the FFI boundary to/from Godot.
Generally ToGodot needs to be implemented to pass a type to Godot, and FromGodot to receive this type from Godot.
GodotType is a stronger bound than GodotConvert, since it expresses that a type is directly representable
in Godot (without intermediate “via”). Every GodotType also implements GodotConvert with Via = Self.
Please read the godot::meta module docs for further information about conversions.
§u64
The type u64 is not supported by ToGodot and FromGodot traits. You can thus not pass it in #[func] parameters/return types.
The reason is that Godot’s Variant type, and therefore also GDScript, only support signed 64-bit integers (i64).
Implicitly wrapping u64 to i64 would be surprising behavior, as the value could suddenly change for large numbers.
As such, godot-rust leaves this decision to users: it’s possible to define a newtype around u64 with custom ToGodot/FromGodot impls.
Required Associated Types§
Required Methods§
fn godot_shape() -> GodotShape
fn godot_shape() -> GodotShape
Which “shape” this type has for property registration (e.g. builtin, enum, …).
godot-rust derives property hints, class names, usage flags, and element metadata from this.
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.