pub trait ColorComponentType: Sized + Clone {
// Required methods
fn from_value(value: f32) -> Self;
fn units() -> CalcUnits;
fn try_from_token(token: &Token<'_>) -> Result<Self, ()>;
fn try_from_leaf(leaf: &Leaf) -> 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: &Leaf) -> Result<Self, ()>
fn try_from_leaf(leaf: &Leaf) -> Result<Self, ()>
Try to create a new component from the given [CalcNodeLeaf] that was resolved from a [CalcNode].
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 ColorComponentType for f32
The raw f32 here is for .
impl ColorComponentType for f32
The raw f32 here is for