map

Macro map 

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

Macro for convenient map initialization with capacity hint

Optimization: Pre-allocates exact capacity to avoid rehashing

ยงExamples

let m = map! {
    "key1" => "value1",
    "key2" => "value2",
};
assert_eq!(m.get("key1"), Some(&"value1"));