pub trait FromValue: Enumeration {
// Required methods
fn from_value<'a>(
value: &'a Self::AssociatedValueType,
) -> Result<Self, UnknownAssociatedValueError<'a, Self>>;
fn from_value_unchecked(value: &Self::AssociatedValueType) -> Self;
}Expand description
Returns the first variant (in the declaration order) associated with the value. More info at Enumeration.
Required Methods§
Sourcefn from_value<'a>(
value: &'a Self::AssociatedValueType,
) -> Result<Self, UnknownAssociatedValueError<'a, Self>>
fn from_value<'a>( value: &'a Self::AssociatedValueType, ) -> Result<Self, UnknownAssociatedValueError<'a, Self>>
Returns the first variant (in the declaration order) associated with the value. Returns error when no variant is associated with the value. More info at Enumeration.
See also FromValue::from_value_unchecked
Sourcefn from_value_unchecked(value: &Self::AssociatedValueType) -> Self
fn from_value_unchecked(value: &Self::AssociatedValueType) -> Self
Returns the first variant (in the declaration order) associated with the value. Panics when no variant is associated with the value. More info at Enumeration.
See also FromValue::from_value
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.