Trait gdnative_core::core_types::variant::ToVariantEq [−][src]
Trait for types whose ToVariant
implementations preserve equivalence.
This means that for all values a
and b
, a == b
is equivalent to
a.to_variant() == b.to_variant()
. Most of the time, this means that to_variant
must
return a "value" type, such as a primitive i32
, a GodotString
, or a TypedArray
.
This is mostly useful as a bound for Dictionary
keys, where the difference between Rust's
structural equality and Godot's referential equality semantics can lead to surprising
behaviors.
This property cannot be checked by the compiler, so ToVariantEq
has no extra methods.
Implementing ToVariantEq
The ToVariantEq
trait is not derivable, because most derived implementations of
ToVariant
don't satisfy the requirements. If you are sure that your type satisfies the
trait, specify that your type implements it with an empty impl
:
#[derive(Eq, PartialEq, ToVariant)] struct MyTypedInt(i32); impl ToVariantEq for MyTypedInt {}
Implementations on Foreign Types
impl ToVariantEq for ()
[src]
impl<'a, T: ?Sized> ToVariantEq for &'a T where
T: ToVariantEq,
[src]
T: ToVariantEq,
impl<'a, T: ?Sized> ToVariantEq for &'a mut T where
T: ToVariantEq,
[src]
T: ToVariantEq,