pub trait FromFeatureStateProperty: Sized {
// Required method
fn from_feature_state_property(prop: &PropertyValue) -> Option<Self>;
}Expand description
Conversion from a PropertyValue stored in feature-state to a concrete
style value type.
Types that have a natural representation in PropertyValue (f32 from
Number, bool from Bool, String from String) implement this directly.
Types without a mapping (e.g. [f32; 4] colour tuples, enum variants)
return None so the fallback value is used instead.
This trait is intentionally sealed to StyleInterpolatable implementors
and does not need to be implemented by downstream code.
Required Methods§
Sourcefn from_feature_state_property(prop: &PropertyValue) -> Option<Self>
fn from_feature_state_property(prop: &PropertyValue) -> Option<Self>
Attempt to convert a property value. Returns None when the
PropertyValue variant does not map to Self.
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.
Implementations on Foreign Types§
Source§impl FromFeatureStateProperty for bool
impl FromFeatureStateProperty for bool
fn from_feature_state_property(prop: &PropertyValue) -> Option<Self>
Source§impl FromFeatureStateProperty for f32
impl FromFeatureStateProperty for f32
fn from_feature_state_property(prop: &PropertyValue) -> Option<Self>
Source§impl FromFeatureStateProperty for String
impl FromFeatureStateProperty for String
fn from_feature_state_property(prop: &PropertyValue) -> Option<Self>
Source§impl FromFeatureStateProperty for [f32; 4]
impl FromFeatureStateProperty for [f32; 4]
Source§fn from_feature_state_property(_prop: &PropertyValue) -> Option<Self>
fn from_feature_state_property(_prop: &PropertyValue) -> Option<Self>
Colour tuples cannot be expressed in a single PropertyValue today.