macro_rules! hashmap {
() => { ... };
( $( $key:expr => $value:expr ),* ) => { ... };
( $( $key:expr => $value:expr ,)* ) => { ... };
}
Expand description
Construct a hash map from a sequence of key/value pairs.
ยงExamples
assert_eq!(
hashmap!{
1 => 11,
2 => 22,
3 => 33
},
HashMap::from(vec![(1, 11), (2, 22), (3, 33)])
);