Macro idmap::idmap [−][src]
macro_rules! idmap {
($($key : expr => $value : expr), *) => { ... };
($($key : expr => $value : expr,) *) => { ... };
}
Expand description
Creates an IdMap
from a list of key-value pairs
Example
#[macro_use] extern crate idmap;
let map = idmap! {
1 => "a",
25 => "b"
};
assert_eq!(map[1], "a");
assert_eq!(map[25], "b");
assert_eq!(map.get(26), None);
// 1 is the first key
assert_eq!(map.keys().next(), Some(&1));