pub struct Argument {
pub value: Option<&'static str>,
pub value_mode: ArgumentValueMode,
pub short: Option<char>,
pub long: &'static str,
pub help: &'static str,
}
Expand description
Information about an argument expected from the command line.
Examples
To indicate a flag style argument:
Argument::short_flag('f', "flag", "enable awesome mode");
To indicate a parameter style argument that expects a value:
// "VALUE" and "NETMASK" are placeholder values displayed in the help message for these
// arguments.
Argument::short_value('v', "val", "VALUE", "how much do you value this usage information");
Argument::value("netmask", "NETMASK", "hides your netface");
To indicate an argument with no short version:
Argument::flag("verbose", "this option is hard to type quickly");
To indicate a positional argument:
Argument::positional("VALUES", "these are positional arguments");
Fields
value: Option<&'static str>
The name of the value to display in the usage information.
value_mode: ArgumentValueMode
Specifies how values should be handled for this this argument.
short: Option<char>
Optional single character shortened argument name.
long: &'static str
The long name of this argument.
help: &'static str
Helpfuly usage information for this argument to display to the user.
Implementations
sourceimpl Argument
impl Argument
pub fn positional(value: &'static str, help: &'static str) -> Argument
pub fn value(
long: &'static str,
value: &'static str,
help: &'static str
) -> Argument
pub fn short_value(
short: char,
long: &'static str,
value: &'static str,
help: &'static str
) -> Argument
pub fn flag(long: &'static str, help: &'static str) -> Argument
pub fn short_flag(
short: char,
long: &'static str,
help: &'static str
) -> Argument
pub fn flag_or_value(
long: &'static str,
value: &'static str,
help: &'static str
) -> Argument
Auto Trait Implementations
impl RefUnwindSafe for Argument
impl Send for Argument
impl Sync for Argument
impl Unpin for Argument
impl UnwindSafe for Argument
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more