[−][src]Macro col_macros::hash_map
Construct or update a map of type Map<K, V> which can be and is an alias to HashMap<K, V> in the types module.
Maps with a capacity and the insert method are accepted,BTreeMap not.
Examples
#![feature(proc_macro_hygiene)] use col_macros::hash_map; use col_macros::types::Map; let mut hash = hash_map!["key1" => 1, "key2" => 2]; let mut hash2 = { let mut temp = Map::with_capacity(2); temp.insert("key1", 1); temp.insert("key2", 2); temp }; assert_eq!(hash["key1"], 1); assert_eq!(hash["key2"], 2); assert_eq!(hash2["key1"], 1); assert_eq!(hash2["key2"], 2); hash_map![for &mut hash, ins "key3" => 3, "key4" => 4]; assert_eq!(hash["key3"], 3); assert_eq!(hash["key4"], 4);