[−][src]Macro col_macros::btree_map
Construct or update a map of type BTMap<K, V> which can be and is an alias to BTreeMap<K, V> in the types module.
It does so by simply creating an array from key-value tuples,read each one,inserting the keys to values and mem::forget the array.
All types of maps are accepted but if a map has capacity and their respective methods, hash_map! is preferred.
Examples
use col_macros::btree_map; use col_macros::types::BTMap; let mut hash = btree_map!["key1" => 1, "key2" => 2]; let mut hash2 = { let mut temp = BTMap::new(); 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); btree_map![for &mut hash, ins "key3" => 3, "key4" => 4]; assert_eq!(hash["key3"], 3); assert_eq!(hash["key4"], 4);