Trait ToGodot
pub trait ToGodot: Sized + GodotConvert {
type ToVia<'v>: GodotType
where Self: 'v;
// Required method
fn to_godot(&self) -> Self::ToVia<'_>;
// Provided method
fn to_variant(&self) -> Variant { ... }
}
Expand description
Defines the canonical conversion to Godot for a type.
It is assumed that all the methods return equal values given equal inputs. Additionally, it is assumed
that if FromGodot
is implemented, converting to Godot and back again will return a value equal to the
starting value.
Violating these assumptions is safe but will give unexpected results.
Please read the godot::meta
module docs for further information about conversions.
Required Associated Types§
type ToVia<'v>: GodotType
where
Self: 'v
type ToVia<'v>: GodotType where Self: 'v
Target type of to_godot()
, which differs from Via
for pass-by-reference types.
Required Methods§
Provided Methods§
fn to_variant(&self) -> Variant
fn to_variant(&self) -> Variant
Converts this type to a Variant.
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.