maplit::hashmap! [] [src]

macro_rules! hashmap {
    (__count) => { ... };
    (__count $a:tt, $($rest:tt,)*) => { ... };
    ($($key:expr => $value:expr,)+) => { ... };
    ( $($key:expr => $value:expr),* ) => { ... };
}

Create a HashMap from a list of key-value pairs

Example

#[macro_use]
extern crate maplit;

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