[][src]Trait rustop::CommandLineArgument

pub trait CommandLineArgument {
    pub fn parse_value(&mut self, arg: &str) -> Result<(), ArgError>;
pub fn write_name(&self, name: Option<&str>) -> Option<String>; pub fn set_default(&mut self) -> Result<(), ArgError> { ... }
pub fn set_unseen(&mut self) { ... }
pub fn is_multi(&self) -> bool { ... }
pub fn default_value(&self) -> Option<String> { ... } }

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.

Loading content...

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.

Loading content...

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.

impl<'a, T> CommandLineArgument for &'a mut Option<T> where
    T: FromStr + DefaultName + Display,
    <T as FromStr>::Err: StdError + 'static, 
[src]

An optional argument option.

Loading content...

Implementors

impl<'a, T> CommandLineArgument for Multi<&'a mut Vec<T>> where
    T: FromStr + DefaultName + Debug,
    <T as FromStr>::Err: StdError + 'static, 
[src]

impl<'a, T> CommandLineArgument for Single<&'a mut T> where
    T: FromStr + DefaultName + Display,
    <T as FromStr>::Err: StdError + 'static, 
[src]

Loading content...