Macro tikv_util::map[][src]

macro_rules! map {
    () => { ... };
    ( $( $k:expr => $v:expr ),+ ) => { ... };
}

Initializes a HashMap with specified key-value pairs.

Examples

// empty map
let m: tikv_util::collections::HashMap<u8, u8> = map!();
assert!(m.is_empty());

// one initial kv pairs.
let m = map!("key" => "value");
assert_eq!(m.len(), 1);
assert_eq!(m["key"], "value");

// initialize with multiple kv pairs.
let m = map!("key1" => "value1", "key2" => "value2");
assert_eq!(m.len(), 2);
assert_eq!(m["key1"], "value1");
assert_eq!(m["key2"], "value2");