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
sourceimpl Into<ColorChoice> for ColorArg
impl Into<ColorChoice> for ColorArg
sourcefn into(self) -> ColorChoice
fn into(self) -> ColorChoice
Performs the conversion.
impl Copy for ColorArg
impl Eq for ColorArg
impl StructuralEq for ColorArg
impl StructuralPartialEq for ColorArg
Auto Trait Implementations
impl RefUnwindSafe for ColorArg
impl Send for ColorArg
impl Sync for ColorArg
impl Unpin for ColorArg
impl UnwindSafe for ColorArg
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more