Trait gdnative::core_types::CoerceFromVariant
source · pub trait CoerceFromVariant: Sized + Sealed {
fn coerce_from_variant(variant: &Variant) -> Self;
}
Expand description
Types that can be coerced from a Variant
. Coercions are provided by Godot, with results
consistent with GDScript. This cannot be implemented for custom types.
CoerceFromVariant
exposes what Godot presents as “best-effort” conversions. These are
weakly-typed conversions to GDScript built-in types, that will never fail, but can return
empty or “default” values, as defined by Godot.
For strongly-typed conversions that can be implemented or derived for custom types, see
FromVariant
.