Trait colstodian::traits::DynColor[][src]

pub trait DynColor {
    fn downcast<Spc: ColorSpace, St: State>(
        &self
    ) -> ColorResult<Color<Spc, St>>;
fn downcast_unchecked<Spc: ColorSpace, St: State>(&self) -> Color<Spc, St>; }
Expand description

A type that implements this trait provides the ability to downcast from a dynamically-typed color to a statically-typed Color. This is implemented for all types that implement AnyColor

Required methods

Attempt to convert to a typed Color. Returns an error if self’s color space and state do not match the given types.

Convert to a typed Color without checking if the color space and state types match this color’s space and state. Use only if you are sure that this color is in the correct format.

Implementors