Macro map_build

Source
macro_rules! map_build {
    ($initializer:expr; $($key:expr => $val:expr),*) => { ... };
}
Expand description

Constructs any Map<Key, Value> type, based on an initializer expression.

§Examples

let custom_map = map_build!{
    MyMap::new();
    "key" => "val",
    "other_key" => value,
    key => "val",
}

// Expands to

let custom_map = MyMap::new();
custom_map.insert("key", "val");
custom_map.insert("other_key", value);
custom_map.insert(key, "val");