[−][src]Struct codespan_reporting::ColorArg
A command line argument that configures the coloring of the output
This can be used with command line argument parsers like clap
or structopt
.
Example
extern crate codespan_reporting; #[macro_use] extern crate structopt; use structopt::StructOpt; use codespan_reporting::termcolor::StandardStream; use codespan_reporting::ColorArg; #[derive(Debug, StructOpt)] #[structopt(name = "groovey-app")] pub struct Opts { /// Configure coloring of output #[structopt( long = "color", parse(try_from_str), default_value = "auto", raw(possible_values = "ColorArg::VARIANTS", case_insensitive = "true") )] pub color: ColorArg, } fn main() { let opts = Opts::from_args(); let writer = StandardStream::stderr(opts.color.into()); }
Methods
impl ColorArg
[src]
pub const VARIANTS: &'static [&'static str]
[src]
Allowed values the argument
This is useful for generating documentation via clap
or structopt
's
possible_values
configuration.
Trait Implementations
impl PartialEq<ColorArg> for ColorArg
[src]
impl Clone for ColorArg
[src]
fn clone(&self) -> ColorArg
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Eq for ColorArg
[src]
impl Into<ColorChoice> for ColorArg
[src]
fn into(self) -> ColorChoice
[src]
impl Copy for ColorArg
[src]
impl Debug for ColorArg
[src]
impl FromStr for ColorArg
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
🔬 This is a nightly-only experimental API. (
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,