Trait style::color::component::ColorComponentType
source · pub trait ColorComponentType: Sized {
// Required methods
fn from_value(value: f32) -> Self;
fn units() -> CalcUnits;
fn try_from_token(token: &Token<'_>) -> Result<Self, ()>;
fn try_from_leaf(leaf: &SpecifiedLeaf) -> Result<Self, ()>;
}
Expand description
An utility trait that allows the construction of ColorComponent
ValueType
’s after parsing a color component.
Required Methods§
sourcefn from_value(value: f32) -> Self
fn from_value(value: f32) -> Self
Construct a new component from a single value.
sourcefn try_from_token(token: &Token<'_>) -> Result<Self, ()>
fn try_from_token(token: &Token<'_>) -> Result<Self, ()>
Try to create a new component from the given token.
sourcefn try_from_leaf(leaf: &SpecifiedLeaf) -> Result<Self, ()>
fn try_from_leaf(leaf: &SpecifiedLeaf) -> Result<Self, ()>
Try to create a new component from the given [CalcNodeLeaf] that was resolved from a [CalcNode].
Implementations on Foreign Types§
source§impl ColorComponentType for f32
impl ColorComponentType for f32
The raw f32 here is for