pub fn from<I: Iterator<Item=String>>(mut cmd_args: I) -> Result<Self> {
        let mut args = HashMap::new();
        let mut i = 0;
        while let Some(arg) = cmd_args.next() {
            if arg.starts_with("--") {
                match cmd_args.next() {
                    Some(value) => args.insert(format!("{}", &arg[2..]), value),
                    None => return Err(Error::new(ErrorKind::Other, "No corresponding value."))
                };
            } else {
                args.insert(format!("{}", i), arg);
                i = i+1;
            }
        }
        Ok(Config{ args: args })
    }
/// Parses the command line arguments into a new Config object.
///
/// Its parsing strategy is as follows:
///   If an argument starts with --, the remaining string is used as the key
///   and the next argument as the associated value.
///   Otherwise the argument is used as the next positional value, counting
///   from zero.
///
Parses the command line arguments into a new Config object.
Its parsing strategy is as follows:
If an argument starts with --, the remaining string is used as the key
and the next argument as the associated value.
Otherwise the argument is used as the next positional value, counting
from zero.
Parses the command line arguments into a new Config object . Its parsing strategy is as follows : If an argument starts with -- the remaining string is used as the key and the next argument as the associated value . Otherwise the argument is used as the next positional value counting from zero .
pub fn from<I: Iterator<Item=String>>(mut cmd_args: I) -> Result<Self> {
        let mut args = HashMap::new();
        let mut i = 0;
        while let Some(arg) = cmd_args.next() {
            if arg.starts_with("--") {
                match cmd_args.next() {
                    Some(value) => args.insert(format!("{}", &arg[2..]), value),
                    None => return Err(Error::new(ErrorKind::Other, "No corresponding value."))
                };
            } else {
                args.insert(format!("{}", i), arg);
                i = i+1;
            }
        }
        Ok(Config{ args: args })
    }
pub fn from < I : Iterator < Item = String > > ( mut cmd_args : I ) -> Result < Self > { let mut args = HashMap :: new ( ) ; let mut i = 0 ; while let Some ( arg ) = cmd_args . next ( ) { if arg . starts_with ( " " ) { match cmd_args . next ( ) { Some ( value ) => args . insert ( format ! ( " " arg [ 2 ] ) , value ) , None => return Err ( Error :: new ( ErrorKind :: Other , " " ) ) } ; } else { args . insert ( format ! ( " " i ) , arg ) ; i = i + 1 ; } } Ok ( Config { args : args } ) }
Parses the command line arguments into a new Config object.
Parses the command line arguments into a new Config object .
cmd_args
I
cmd_args
I