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

pub fn key_val<K, V>(opt: &str) -> Result<(K, V), AnyError> where
    K: FromStr,
    K::Err: Error + Send + Sync + 'static,
    V: FromStr,
    V::Err: Error + Send + Sync + '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),
        number_of_values(1),
    )]
    defines: Vec<(String, String)>,
}