std_macro_extensions/hash_map/
macro.rs

1/// Creates a new `HashMap` instance.
2///
3/// This macro can be used in two forms:
4/// - Without arguments, it creates an empty `HashMap`.
5/// - With key-value pairs, it creates a `HashMap` and inserts the provided pairs into it.
6#[macro_export]
7macro_rules! hash_map {
8    () => {
9        std::collections::HashMap::new()
10    };
11    ($($key:expr => $val:expr),*) => {{
12        let mut map = std::collections::HashMap::new();
13        $( map.insert($key, $val); )*
14        map
15    }};
16}