Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::collections::HashMap;
- macro_rules! hashmap {
- {$($key:expr => $value:expr),*} => {{
- let mut __hm = HashMap::new();
- $(
- __hm.insert($key, $value);
- )*
- __hm
- }}
- }
- fn main() {
- let hm = hashmap!{1 => 2, 3 => 4};
- println!("{:?}", hm);
- }
Add Comment
Please, Sign In to add comment