macro_rules! hash_map {
($($key:expr => $val:expr), *) => { ... };
}
Expand description
Convenience macro to create a HashMap
from a predfined set of key - value pairs
ยงExample
let map = hash_map! {
"yes" => 0.,
"no" => 1.,
"pi" => std::f64::consts::PI
};
for (key, val) in map.iter() {
println!("Key: {key}, Value: {val}");
}