macro_rules! hash_map { () => { ... }; ($($key:expr => $val:expr),*) => { ... }; }
Expand description
Creates a new HashMap instance.
This macro can be used in two forms:
- Without arguments, it creates an empty 
HashMap. - With key-value pairs, it creates a 
HashMapand inserts the provided pairs into it. 
ยงExamples
Creating an empty HashMap:
let my_map = map!();
assert!(my_map.is_empty());Creating a HashMap with key-value pairs:
use std_macro_extensions::*;
let my_map = hash_map!("a" => 1, "b" => 2);
assert_eq!(my_map["a"], 1);
assert_eq!(my_map["b"], 2);