OptionalColor

Trait OptionalColor 

Source
pub trait OptionalColor: Seal {
    type Color: WriteColor;

    // Required method
    fn get(self) -> Option<Self::Color>;

    // Provided method
    fn color_kind(self) -> ColorKind { ... }
}
Expand description

An optional color type. This is used to abstract over WriteColor and Option<W> where W: WriteColor

Required Associated Types§

Source

type Color: WriteColor

The color type

Required Methods§

Source

fn get(self) -> Option<Self::Color>

Get the color value

Provided Methods§

Source

fn color_kind(self) -> ColorKind

Get the color kind, this is used to check if formatting this color is supported on the current terminal when the supports-color feature is enabled

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<C: OptionalColor> OptionalColor for Option<C>

Source§

type Color = <C as OptionalColor>::Color

Source§

fn get(self) -> Option<Self::Color>

Implementors§