[][src]Macro multi_map::multimap

macro_rules! multimap {
    (@single $($x:tt)*) => { ... };
    (@count $($rest:expr),*) => { ... };
    ($($key1:expr, $key2:expr => $value:expr,)+) => { ... };
    ($($key1:expr, $key2:expr => $value:expr),*) => { ... };
}

Create a MultiMap from a list of key-value tuples

Example

#[macro_use]
extern crate multi_map;
use multi_map::MultiMap;

#[derive(Hash,Clone,PartialEq,Eq)]
enum ThingIndex {
    IndexOne,
    IndexTwo,
    IndexThree,
};

let map = multimap!{
    1, ThingIndex::IndexOne => "Chicken Fried Steak",
    2, ThingIndex::IndexTwo => "Blueberry Pancakes",
};

assert!(*map.get_alt(&ThingIndex::IndexOne).unwrap() == "Chicken Fried Steak");
assert!(*map.get(&2).unwrap() == "Blueberry Pancakes");