Enum colored::Styles

source ·
pub enum Styles {
    Clear,
    Bold,
    Dimmed,
    Underline,
    Reversed,
    Italic,
    Blink,
    Hidden,
    Strikethrough,
}
Expand description

Enum containing all of the available style settings that can be applied to a Styles and by extension, a colrized type.

§Implementation of bitwise logical operators

The implementations of BitAnd, BitOr, BitXor, and Not are really extensions of Style’s implementations of the same. BitOr is great for starting chains of Styles’s for creating Style’s.

let my_styles =
    // BitOr<Styles> for Styles (Styles | Styles) = Style
    Styles::Bold | Styles::Underline
    // BitOr<Styles> for Style (Style | Styles) = Style
    | Styles::Italic;

for s in [Styles::Bold, Styles::Underline, Styles::Italic] {
    assert!(my_styles.contains(s));
}

Not has far fewer use cases but can still find use in turning a Styles into a Style with all styles activated except that Styles.

let everything_but_bold = !Styles::Bold;

assert!(everything_but_bold.contains(Styles::Underline));
assert!(everything_but_bold.contains(Styles::Strikethrough));
assert!(!everything_but_bold.contains(Styles::Bold));

Variants§

§

Clear

§

Bold

§

Dimmed

§

Underline

§

Reversed

§

Italic

§

Hidden

§

Strikethrough

Implementations§

source§

impl Styles

source

fn to_str<'a>(self) -> &'a str

source

fn to_u8(self) -> u8

source

fn from_u8(u: u8) -> Option<Vec<Styles>>

Trait Implementations§

source§

impl BitAnd<&Style> for &Styles

source§

type Output = <Styles as BitAnd>::Output

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &Style) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<&Style> for Styles

source§

type Output = <Styles as BitAnd>::Output

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &Style) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<&Styles> for &Style

source§

type Output = <Style as BitAnd>::Output

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &Styles) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<&Styles> for &Styles

source§

type Output = <Styles as BitAnd>::Output

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &Styles) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<&Styles> for Style

source§

type Output = <Style as BitAnd>::Output

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &Styles) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<&Styles> for Styles

source§

type Output = <Styles as BitAnd>::Output

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &Styles) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<Style> for &Styles

source§

type Output = <Styles as BitAnd>::Output

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: Style) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<Style> for Styles

source§

type Output = Style

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: Style) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<Styles> for &Style

source§

type Output = <Style as BitAnd>::Output

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: Styles) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<Styles> for &Styles

source§

type Output = <Styles as BitAnd>::Output

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: Styles) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd<Styles> for Style

source§

type Output = Style

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: Styles) -> Self::Output

Performs the & operation. Read more
source§

impl BitAnd for Styles

source§

type Output = Style

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: Styles) -> Self::Output

Performs the & operation. Read more
source§

impl BitAndAssign<&Styles> for Style

source§

fn bitand_assign(&mut self, other: &Styles)

Performs the &= operation. Read more
source§

impl BitAndAssign<Styles> for Style

source§

fn bitand_assign(&mut self, other: Styles)

Performs the &= operation. Read more
source§

impl BitOr<&Style> for &Styles

source§

type Output = <Styles as BitOr>::Output

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &Style) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<&Style> for Styles

source§

type Output = <Styles as BitOr>::Output

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &Style) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<&Styles> for &Style

source§

type Output = <Style as BitOr>::Output

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &Styles) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<&Styles> for &Styles

source§

type Output = <Styles as BitOr>::Output

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &Styles) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<&Styles> for Style

source§

type Output = <Style as BitOr>::Output

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &Styles) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<&Styles> for Styles

source§

type Output = <Styles as BitOr>::Output

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &Styles) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<Style> for &Styles

source§

type Output = <Styles as BitOr>::Output

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: Style) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<Style> for Styles

source§

type Output = Style

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: Style) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<Styles> for &Style

source§

type Output = <Style as BitOr>::Output

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: Styles) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<Styles> for &Styles

source§

type Output = <Styles as BitOr>::Output

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: Styles) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr<Styles> for Style

source§

type Output = Style

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: Styles) -> Self::Output

Performs the | operation. Read more
source§

impl BitOr for Styles

source§

type Output = Style

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: Styles) -> Self::Output

Performs the | operation. Read more
source§

impl BitOrAssign<&Styles> for Style

source§

fn bitor_assign(&mut self, other: &Styles)

Performs the |= operation. Read more
source§

impl BitOrAssign<Styles> for Style

source§

fn bitor_assign(&mut self, other: Styles)

Performs the |= operation. Read more
source§

impl BitXor<&Style> for &Styles

source§

type Output = <Styles as BitXor>::Output

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &Style) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<&Style> for Styles

source§

type Output = <Styles as BitXor>::Output

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &Style) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<&Styles> for &Style

source§

type Output = <Style as BitXor>::Output

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &Styles) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<&Styles> for &Styles

source§

type Output = <Styles as BitXor>::Output

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &Styles) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<&Styles> for Style

source§

type Output = <Style as BitXor>::Output

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &Styles) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<&Styles> for Styles

source§

type Output = <Styles as BitXor>::Output

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &Styles) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<Style> for &Styles

source§

type Output = <Styles as BitXor>::Output

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: Style) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<Style> for Styles

source§

type Output = Style

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: Style) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<Styles> for &Style

source§

type Output = <Style as BitXor>::Output

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: Styles) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<Styles> for &Styles

source§

type Output = <Styles as BitXor>::Output

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: Styles) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor<Styles> for Style

source§

type Output = Style

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: Styles) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXor for Styles

source§

type Output = Style

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: Styles) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXorAssign<&Styles> for Style

source§

fn bitxor_assign(&mut self, other: &Styles)

Performs the ^= operation. Read more
source§

impl BitXorAssign<Styles> for Style

source§

fn bitxor_assign(&mut self, other: Styles)

Performs the ^= operation. Read more
source§

impl Clone for Styles

source§

fn clone(&self) -> Styles

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Styles

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<&Styles> for Style

source§

fn from(value: &Styles) -> Self

Converts to this type from the input type.
source§

impl From<Styles> for Style

source§

fn from(value: Styles) -> Self

Converts to this type from the input type.
source§

impl FromIterator<Styles> for Style

source§

fn from_iter<T: IntoIterator<Item = Styles>>(iter: T) -> Self

Creates a value from an iterator. Read more
source§

impl Not for &Styles

source§

type Output = Style

The resulting type after applying the ! operator.
source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
source§

impl Not for Styles

source§

type Output = Style

The resulting type after applying the ! operator.
source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
source§

impl PartialEq for Styles

source§

fn eq(&self, other: &Styles) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for Styles

source§

impl Eq for Styles

source§

impl StructuralPartialEq for Styles

Auto Trait Implementations§

§

impl Freeze for Styles

§

impl RefUnwindSafe for Styles

§

impl Send for Styles

§

impl Sync for Styles

§

impl Unpin for Styles

§

impl UnwindSafe for Styles

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.