hash_map!() { /* proc-macro */ }
Expand description
An initializer for HashMap
, allowing for entries to be specified individually
or for the same value to be given to multiple keys using the ..
operator.
Usage
use velcro::hash_map;
let mut map1 = HashMap::new();
map1.insert('a', 0);
map1.insert('b', 1);
map1.insert('c', 1);
map1.insert('d', 1);
map1.insert('e', 1);
map1.insert('f', 2);
let map2 = hash_map! {
'a': 0,
..('b'..='e'): 1,
'f': 2
};
assert_eq!(map1, map2);