pub trait CommandLineArgument {
// Required methods
fn parse_value(&mut self, arg: &str) -> Result<(), ArgError>;
fn write_name(&self, name: Option<&str>) -> Option<String>;
// Provided methods
fn set_default(&mut self) -> Result<(), ArgError> { ... }
fn set_unseen(&mut self) { ... }
fn is_multi(&self) -> bool { ... }
fn default_value(&self) -> Option<String> { ... }
}
Expand description
Trait for variables that can be used as option arguments.
Required Methods§
Provided Methods§
Sourcefn set_default(&mut self) -> Result<(), ArgError>
fn set_default(&mut self) -> Result<(), ArgError>
Called if the option has been specified without argument.
The method should return the error ArgError::MissingArgument
if the argument is required.
Sourcefn set_unseen(&mut self)
fn set_unseen(&mut self)
Called if the argument has never been seen.
This method can be used to store a specific “never seen” value in the variable.
Sourcefn default_value(&self) -> Option<String>
fn default_value(&self) -> Option<String>
Return the initial value as a string.
Implementations on Foreign Types§
Source§impl<'a> CommandLineArgument for &'a mut bool
A flag.
impl<'a> CommandLineArgument for &'a mut bool
A flag.
A flag must not take an argument but always uses its default value.
Source§impl<'a, T> CommandLineArgument for &'a mut Option<T>
An optional argument option.
impl<'a, T> CommandLineArgument for &'a mut Option<T>
An optional argument option.