Trait colstodian::traits::DynColorAlpha [−][src]
pub trait DynColorAlpha { fn downcast<Spc: ColorSpace, A: AlphaState>(
&self
) -> ColorResult<ColorAlpha<Spc, A>>; fn downcast_unchecked<Spc: ColorSpace, A: AlphaState>(
&self
) -> ColorAlpha<Spc, A>; }
Expand description
A type that implements this trait provides the ability to downcast from a dynamically-typed
color to a statically-typed ColorAlpha
. This is implemented for all types that implement AnyColorAlpha
Required methods
fn downcast<Spc: ColorSpace, A: AlphaState>(
&self
) -> ColorResult<ColorAlpha<Spc, A>>
fn downcast<Spc: ColorSpace, A: AlphaState>(
&self
) -> ColorResult<ColorAlpha<Spc, A>>
Attempt to downcast to a typed ColorAlpha
. Returns an error if self
’s color space and alpha state do not match
the given types.
fn downcast_unchecked<Spc: ColorSpace, A: AlphaState>(
&self
) -> ColorAlpha<Spc, A>
fn downcast_unchecked<Spc: ColorSpace, A: AlphaState>(
&self
) -> ColorAlpha<Spc, A>
Downcast to a typed ColorAlpha
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.