Enum should_color::ColorChoice
source · [−]pub enum ColorChoice {
Never,
Auto,
Always,
}Expand description
Possible color choices for the output.
Clap interoperability
If the clap feature is enabled then
ColorChoice can be converted to and from clap::ColorChoice.
Moreover it implements clap::ValueEnum, hence can be used as
#[derive(clap::Parser)]
struct Cli {
/// Coloring of the output
#[clap(long, value_name = "WHEN", arg_enum, global = true)]
color: Option<should_color::ColorChoice>,
// Other arguments...
}Variants
Never
The output will not be colorized.
Auto
The output will be colorized if the output device is a tty, i.e. when the output goes directly to a text screen or terminal emulator window.
Always
The output will be colorized.
Trait Implementations
sourceimpl Clone for ColorChoice
impl Clone for ColorChoice
sourcefn clone(&self) -> ColorChoice
fn clone(&self) -> ColorChoice
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for ColorChoice
impl Debug for ColorChoice
sourceimpl From<ColorChoice> for ColorChoice
Available on crate feature clap only.
impl From<ColorChoice> for ColorChoice
clap only.sourcefn from(color_choice: ColorChoice) -> ColorChoice
fn from(color_choice: ColorChoice) -> ColorChoice
Converts to this type from the input type.
sourceimpl From<ColorChoice> for ColorChoice
Available on crate feature clap only.
impl From<ColorChoice> for ColorChoice
clap only.sourcefn from(color_choice: ColorChoice) -> ColorChoice
fn from(color_choice: ColorChoice) -> ColorChoice
Converts to this type from the input type.
sourceimpl Ord for ColorChoice
impl Ord for ColorChoice
sourcefn cmp(&self, other: &ColorChoice) -> Ordering
fn cmp(&self, other: &ColorChoice) -> Ordering
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialEq<ColorChoice> for ColorChoice
impl PartialEq<ColorChoice> for ColorChoice
sourcefn eq(&self, other: &ColorChoice) -> bool
fn eq(&self, other: &ColorChoice) -> bool
This method tests for self and other values to be equal, and is used
by ==. Read more
sourceimpl PartialOrd<ColorChoice> for ColorChoice
impl PartialOrd<ColorChoice> for ColorChoice
sourcefn partial_cmp(&self, other: &ColorChoice) -> Option<Ordering>
fn partial_cmp(&self, other: &ColorChoice) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
sourceimpl ValueEnum for ColorChoice
impl ValueEnum for ColorChoice
sourcefn value_variants<'a>() -> &'a [Self]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
fn value_variants<'a>() -> &'a [Self]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
All possible argument values, in display order.
sourcefn to_possible_value<'a>(&self) -> Option<PossibleValue<'a>>
fn to_possible_value<'a>(&self) -> Option<PossibleValue<'a>>
The canonical argument value. Read more
impl Copy for ColorChoice
impl Eq for ColorChoice
impl StructuralEq for ColorChoice
impl StructuralPartialEq for ColorChoice
Auto Trait Implementations
impl RefUnwindSafe for ColorChoice
impl Send for ColorChoice
impl Sync for ColorChoice
impl Unpin for ColorChoice
impl UnwindSafe for ColorChoice
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key and return true if they are equal.