macro_rules! bidir_map {
(@single $($x:tt)*) => { ... };
(@count $($rest:expr),*) => { ... };
($($key:expr => $value:expr,)+) => { ... };
($($key:expr => $value:expr),*) => { ... };
}Expand description
Create a BidirMap from a set of K/V-K/V pairs.
ยงExamples
#[macro_use]
extern crate bidir_map;
let map = bidir_map!(
"a" => 1,
"b" => 2,
);
assert_eq!(map.get_by_first(&"a"), Some(&1));
assert_eq!(map.get_by_second(&2), Some(&"b"));
assert_eq!(map.get_by_first(&"c"), None);