macro_rules! hmap {
(@single $($x:tt)*) => { ... };
(@count $($rest:expr),*) => { ... };
($($key:expr => $value:expr),* $(,)?) => { ... };
}
Expand description
Literally just a HashMap literal with keys and values into’d.
let m: HashMap<String, String> = hmap!{ "key" => "value" };
assert_eq!(m.get("key"), Some(&"value".to_string()))