Macro clap::values_t [] [src]

macro_rules! values_t {
    ($m:ident, $v:expr, $t:ty) => { ... };
    ($m:ident.values_of($v:expr), $t:ty) => { ... };
}

Convenience macro getting a typed value Vec<T> where T implements std::str::FromStr This macro returns a clap::Result<Vec<T>> which allows you as the developer to decide what you'd like to do on a failed parse.

Examples

let matches = App::new("myapp")
              .arg_from_usage("[seq]... 'A sequence of pos whole nums, i.e. 20 45'")
              .get_matches();

let vals = values_t!(matches.values_of("seq"), u32).unwrap_or_else(|e| e.exit());
for v in &vals {
    println!("{} + 2: {}", v, v + 2);
}

let vals = values_t!(matches, "seq", u32).unwrap_or_else(|e| e.exit());
for v in &vals {
    println!("{} + 2: {}", v, v + 2);
}