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§

source

fn from_value(value: f32) -> Self

Construct a new component from a single value.

source

fn units() -> CalcUnits

Return the CalcUnits flags that the impl can handle.

source

fn try_from_token(token: &Token<'_>) -> Result<Self, ()>

Try to create a new component from the given token.

source

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

The raw f32 here is for .

source§

fn from_value(value: f32) -> Self

source§

fn units() -> CalcUnits

source§

fn try_from_token(token: &Token<'_>) -> Result<Self, ()>

source§

fn try_from_leaf(leaf: &SpecifiedLeaf) -> Result<Self, ()>

Implementors§