Struct structopt_flags::LogLevelNoDefLower
source · pub struct LogLevelNoDefLower { /* private fields */ }
Expand description
This struct provides the --log
and -l
cli option, with no default
No default value is provided
extern crate log;
extern crate structopt_flags;
#[macro_use]
extern crate structopt;
use log::LevelFilter;
use structopt::StructOpt;
use structopt_flags::GetWithDefault; // to access get_log_level
#[derive(Debug, StructOpt)]
#[structopt(name = "log_level_no_def_lower", about = "An example using the LogLevelNoDefLower option")]
struct Opt {
#[structopt(flatten)]
log_level: structopt_flags::LogLevelNoDefLower,
}
fn main() {
let opt = Opt::from_args();
let filter_level = opt.log_level.get_with_default(LevelFilter::Warn);
// set log level
}
Trait Implementations
sourceimpl Clone for LogLevelNoDefLower
impl Clone for LogLevelNoDefLower
sourcefn clone(&self) -> LogLevelNoDefLower
fn clone(&self) -> LogLevelNoDefLower
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 moresourceimpl Debug for LogLevelNoDefLower
impl Debug for LogLevelNoDefLower
sourceimpl Display for LogLevelNoDefLower
impl Display for LogLevelNoDefLower
sourceimpl GetWithDefault for LogLevelNoDefLower
impl GetWithDefault for LogLevelNoDefLower
type Item = LevelFilter
sourcefn get_with_default(&self, default: Self::Item) -> Self::Item
fn get_with_default(&self, default: Self::Item) -> Self::Item
This function can be used to retrieve the value of the command line option
taking in account the default value used as argument Read more
sourceimpl StructOpt for LogLevelNoDefLower
impl StructOpt for LogLevelNoDefLower
sourcefn from_clap(matches: &ArgMatches<'_>) -> Self
fn from_clap(matches: &ArgMatches<'_>) -> Self
Creates the struct from
clap::ArgMatches
. It cannot fail
with a parameter generated by clap
by construction. Read moresourcefn from_args() -> Selfwhere
Self: Sized,
fn from_args() -> Selfwhere
Self: Sized,
Gets the struct from the command line arguments. Print the
error message and quit the program in case of failure. Read more
sourcefn from_iter<I>(iter: I) -> Selfwhere
Self: Sized,
I: IntoIterator,
<I as IntoIterator>::Item: Into<OsString> + Clone,
fn from_iter<I>(iter: I) -> Selfwhere
Self: Sized,
I: IntoIterator,
<I as IntoIterator>::Item: Into<OsString> + 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 moresourcefn from_iter_safe<I>(iter: I) -> Result<Self, Error>where
Self: Sized,
I: IntoIterator,
<I as IntoIterator>::Item: Into<OsString> + Clone,
fn from_iter_safe<I>(iter: I) -> Result<Self, Error>where
Self: Sized,
I: IntoIterator,
<I as IntoIterator>::Item: Into<OsString> + Clone,
Gets the struct from any iterator such as a
Vec
of your making. Read moreAuto Trait Implementations
impl RefUnwindSafe for LogLevelNoDefLower
impl Send for LogLevelNoDefLower
impl Sync for LogLevelNoDefLower
impl Unpin for LogLevelNoDefLower
impl UnwindSafe for LogLevelNoDefLower
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