Macro indexmap_with_default

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

Create an IndexMap from a list of key-value pairs and a BuildHasherDefault-wrapped custom hasher.

§Example

use indexmap::indexmap_with_default;
use fnv::FnvHasher;

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

// "a" is the first key
assert_eq!(map.keys().next(), Some(&"a"));