maplit

Macro btreemap

Source
macro_rules! btreemap {
    ($($key:expr => $value:expr,)+) => { ... };
    ( $($key:expr => $value:expr),* ) => { ... };
}
Expand description

Create a BTreeMap from a list of key-value pairs

ยงExample

#[macro_use] extern crate maplit;

let map = btreemap!{
    "a" => 1,
    "b" => 2,
};
assert_eq!(map["a"], 1);
assert_eq!(map["b"], 2);
assert_eq!(map.get("c"), None);