Trait VariantConstraint
pub trait VariantConstraint:
Sized
+ Debug
+ PartialEq
+ Clone {
type DataArg<'a>: Debug + PartialEq + Clone;
type RetArg: Debug + PartialEq + Clone;
// Required method
fn as_arg(&self) -> Self::DataArg<'_>;
}Expand description
Used for statically defining the allowed types stored in Variants.
Required Associated Types§
type DataArg<'a>: Debug + PartialEq + Clone
type DataArg<'a>: Debug + PartialEq + Clone
Specifies the type of an argument that provides a value to Variant.
Generally, this type matches Self, except for KanziString, Resource, and ResourceId.
KanziString- Uses &KanziStrto avoid unnecessary allocations.Resource- UsesOption<&Self>to allow settingVarianttonullptr.ResourceId- Uses&Selfto avoid unnecessary allocations.
Required Methods§
fn as_arg(&self) -> Self::DataArg<'_>
fn as_arg(&self) -> Self::DataArg<'_>
Converts Self to a type accepted by Variant::create or Object::set_property.
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.