Struct structopt_flags::LogLevelOpt [−][src]
pub struct LogLevelOpt { /* fields omitted */ }
This struct provides the --log
and -L
cli option
By default, the log level is set to info.
extern crate structopt_flags; #[macro_use] extern crate structopt; use structopt::StructOpt; use structopt_flags::LogLevel; // to access get_log_level #[derive(Debug, StructOpt)] #[structopt(name = "log_level_opt", about = "An example using the LogLevelOpt option")] struct Opt { #[structopt(flatten)] log_level: structopt_flags::LogLevelOpt, } fn main() { let opt = Opt::from_args(); let filter_level = opt.log_level.get_level_filter(); // set log level }
Trait Implementations
impl StructOpt for LogLevelOpt
[src]
impl StructOpt for LogLevelOpt
fn clap<'a, 'b>() -> App<'a, 'b>
[src]
fn clap<'a, 'b>() -> App<'a, 'b>
Returns the corresponding clap::App
.
fn from_clap(matches: &ArgMatches) -> Self
[src]
fn from_clap(matches: &ArgMatches) -> Self
Creates the struct from clap::ArgMatches
. It cannot fail with a parameter generated by clap
by construction. Read more
fn from_args() -> Self
[src]
fn from_args() -> Self
Gets the struct from the command line arguments. Print the error message and quit the program in case of failure. Read more
fn from_iter<I>(iter: I) -> Self where
I: IntoIterator,
<I as IntoIterator>::Item: Into<OsString>,
<I as IntoIterator>::Item: Clone,
[src]
fn from_iter<I>(iter: I) -> Self where
I: IntoIterator,
<I as IntoIterator>::Item: Into<OsString>,
<I as IntoIterator>::Item: Clone,
Gets the struct from any iterator such as a Vec
of your making. Print the error message and quit the program in case of failure. Read more
fn from_iter_safe<I>(iter: I) -> Result<Self, Error> where
I: IntoIterator,
<I as IntoIterator>::Item: Into<OsString>,
<I as IntoIterator>::Item: Clone,
[src]
fn from_iter_safe<I>(iter: I) -> Result<Self, Error> where
I: IntoIterator,
<I as IntoIterator>::Item: Into<OsString>,
<I as IntoIterator>::Item: Clone,
Gets the struct from any iterator such as a Vec
of your making. Read more
impl Debug for LogLevelOpt
[src]
impl Debug for LogLevelOpt
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Clone for LogLevelOpt
[src]
impl Clone for LogLevelOpt
fn clone(&self) -> LogLevelOpt
[src]
fn clone(&self) -> LogLevelOpt
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl LogLevel for LogLevelOpt
[src]
impl LogLevel for LogLevelOpt
fn get_level_filter(&self) -> LevelFilter
[src]
fn get_level_filter(&self) -> LevelFilter
Return the level filter. Read more
fn get_log_level(&self) -> Option<Level>
[src]
fn get_log_level(&self) -> Option<Level>
Return the log level. Read more
impl Display for LogLevelOpt
[src]
impl Display for LogLevelOpt
Auto Trait Implementations
impl Send for LogLevelOpt
impl Send for LogLevelOpt
impl Sync for LogLevelOpt
impl Sync for LogLevelOpt