Enum ColorChoice

enum ColorChoice

ColorChoice represents the color preferences of an end user.

The Default implementation for this type will select Auto, which tries to do the right thing based on the current environment.

The FromStr implementation for this type converts a lowercase kebab-case string of the variant name to the corresponding variant. Any other string results in an error.

Variants

Always

Try very hard to emit colors. This includes emitting ANSI colors on Windows if the console API is unavailable.

AlwaysAnsi

AlwaysAnsi is like Always, except it never tries to use anything other than emitting ANSI color codes.

Auto

Try to use colors, but don't force the issue. If the console isn't available on Windows, or if TERM=dumb, or if NO_COLOR is defined, for example, then don't use colors.

Never

Never emit colors.

Implementations

impl Clone for ColorChoice

fn clone(self: &Self) -> ColorChoice

impl Copy for ColorChoice

impl Debug for ColorChoice

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

impl Default for ColorChoice

fn default() -> ColorChoice

impl Eq for ColorChoice

impl Freeze for ColorChoice

impl FromStr for ColorChoice

fn from_str(s: &str) -> Result<ColorChoice, ColorChoiceParseError>

impl PartialEq for ColorChoice

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

impl RefUnwindSafe for ColorChoice

impl Send for ColorChoice

impl StructuralPartialEq for ColorChoice

impl Sync for ColorChoice

impl Unpin for ColorChoice

impl UnwindSafe for ColorChoice

impl<T> Any for ColorChoice

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for ColorChoice

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for ColorChoice

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

impl<T> CloneToUninit for ColorChoice

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> From for ColorChoice

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for ColorChoice

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T, U> Into for ColorChoice

fn into(self: Self) -> U

Calls U::from(self).

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

impl<T, U> TryFrom for ColorChoice

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

impl<T, U> TryInto for ColorChoice

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