[−][src]Trait rustop::CommandLineArgument
Trait for variables that can be used as option arguments.
Required methods
pub fn parse_value(&mut self, arg: &str) -> Result<(), ArgError>
[src]
Add the value from the command line string.
pub fn write_name(&self, name: Option<&str>) -> Option<String>
[src]
Return a description of a argument of this type.
name
is a use-defined description (if any) of the underlying
type. The function may add additional formatting.
Provided methods
pub fn set_default(&mut self) -> Result<(), ArgError>
[src]
Called if the option has been specified without argument.
The method should return the error ArgError::MissingArgument
if the argument is required.
pub fn set_unseen(&mut self)
[src]
Called if the argument has never been seen.
This method can be used to store a specific "never seen" value in the variable.
pub fn is_multi(&self) -> bool
[src]
Return true if the argument can parsed multiple times.
pub fn default_value(&self) -> Option<String>
[src]
Return the initial value as a string.
Implementations on Foreign Types
impl<'a> CommandLineArgument for &'a mut bool
[src]
A flag.
A flag must not take an argument but always uses its default value.
pub fn parse_value(&mut self, arg: &str) -> Result<(), ArgError>
[src]
pub fn set_default(&mut self) -> Result<(), ArgError>
[src]
pub fn write_name(&self, _name: Option<&str>) -> Option<String>
[src]
impl<'a, T> CommandLineArgument for &'a mut Option<T> where
T: FromStr + DefaultName + Display,
<T as FromStr>::Err: StdError + 'static,
[src]
T: FromStr + DefaultName + Display,
<T as FromStr>::Err: StdError + 'static,
An optional argument option.
pub fn parse_value(&mut self, arg: &str) -> Result<(), ArgError>
[src]
pub fn set_default(&mut self) -> Result<(), ArgError>
[src]
pub fn set_unseen(&mut self)
[src]
pub fn default_value(&self) -> Option<String>
[src]
pub fn write_name(&self, name: Option<&str>) -> Option<String>
[src]
Implementors
impl<'a, T> CommandLineArgument for Multi<&'a mut Vec<T>> where
T: FromStr + DefaultName + Debug,
<T as FromStr>::Err: StdError + 'static,
[src]
T: FromStr + DefaultName + Debug,
<T as FromStr>::Err: StdError + 'static,
pub fn parse_value(&mut self, arg: &str) -> Result<(), ArgError>
[src]
pub fn is_multi(&self) -> bool
[src]
pub fn default_value(&self) -> Option<String>
[src]
pub fn write_name(&self, name: Option<&str>) -> Option<String>
[src]
impl<'a, T> CommandLineArgument for Single<&'a mut T> where
T: FromStr + DefaultName + Display,
<T as FromStr>::Err: StdError + 'static,
[src]
T: FromStr + DefaultName + Display,
<T as FromStr>::Err: StdError + 'static,