macro_rules! map {
( $($key:tt : $val:expr),* $(,)? ) => { ... };
(@replace $_t:tt $e:expr ) => { ... };
(@count $($t:tt)*) => { ... };
}Expand description
A slightly more concise version of “hashmap!” for the concision-minded. Create a HashMap from a list of key-value pairs
§Example
#[macro_use] extern crate maplit2;
let map = map!{
"a": 1,
"b": 2,
};
assert_eq!(map["a"], 1);
assert_eq!(map["b"], 2);
assert_eq!(map.get("c"), None);