Struct codespan_reporting::term::ColorArg
source · pub struct ColorArg(pub ColorChoice);
Expand description
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
use codespan_reporting::term::termcolor::StandardStream;
use codespan_reporting::term::ColorArg;
use structopt::StructOpt;
#[derive(Debug, StructOpt)]
#[structopt(name = "groovey-app")]
pub struct Opts {
/// Configure coloring of output
#[structopt(
long = "color",
default_value = "auto",
possible_values = ColorArg::VARIANTS,
case_insensitive = true,
)]
pub color: ColorArg,
}
let opts = Opts::from_args();
let writer = StandardStream::stderr(opts.color.into());
Tuple Fields§
§0: ColorChoice
Implementations§
Trait Implementations§
source§impl Into<ColorChoice> for ColorArg
impl Into<ColorChoice> for ColorArg
source§fn into(self) -> ColorChoice
fn into(self) -> ColorChoice
Converts this type into the (usually inferred) input type.
impl Copy for ColorArg
impl Eq for ColorArg
impl StructuralPartialEq for ColorArg
Auto Trait Implementations§
impl Freeze for ColorArg
impl RefUnwindSafe for ColorArg
impl Send for ColorArg
impl Sync for ColorArg
impl Unpin for ColorArg
impl UnwindSafe for ColorArg
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)