[][src]Function spirit::utils::key_val

pub fn key_val<K, V>(opt: &str) -> Result<(K, V), Error> where
    K: FromStr,
    K::Err: Fail + 'static,
    V: FromStr,
    V::Err: Fail + 'static, 

A helper for deserializing map-like command line arguments.

Examples

#[derive(Debug, StructOpt)]
struct MyOpts {
    #[structopt(
        short = "D",
        long = "define",
        parse(try_from_str = "spirit::utils::key_val"),
        raw(number_of_values = "1"),
    )]
    defines: Vec<(String, String)>,
}