string_args

Macro string_args 

Source
macro_rules! string_args {
    (@single $($x:tt)*) => { ... };
    (@count $($rest:expr),*) => { ... };
    ($($key:expr => $value:expr,)+) => { ... };
    ($($key:expr => $value:expr),*) => { ... };
}
Expand description

Creates a HashMap<String, Box<dyn Any>> from a list of key-value pairs.

ยงExample

use apply_string_args::string_args;
fn main() {
    let map = string_args!{
        "a" => "foo",
        "b" => "bar",
    };
    assert_eq!(*map[&"a".to_owned()], "foo");
    assert_eq!(*map[&"b".to_owned()], "bar");
    assert_eq!(map.get(&"c".to_owned()), None);
}