pub trait ToGodot: Sized + GodotConvert {
// Required method
fn to_godot(&self) -> Self::Via;
// Provided methods
fn into_godot(self) -> Self::Via { ... }
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.
Required Methods§
Provided Methods§
fn into_godot(self) -> Self::Via
fn into_godot(self) -> Self::Via
Converts this type to the Godot type.
This can in some cases enable minor optimizations, such as avoiding reference counting operations.
fn to_variant(&self) -> Variant
fn to_variant(&self) -> Variant
Converts this type to a Variant.
Object Safety§
This trait is not object safe.