Guest User

Untitled

a guest
Apr 22nd, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. use std::collections::HashMap;
  2.  
  3. macro_rules! hashmap {
  4. {$($key:expr => $value:expr),*} => {{
  5. let mut __hm = HashMap::new();
  6. $(
  7. __hm.insert($key, $value);
  8. )*
  9. __hm
  10. }}
  11. }
  12.  
  13. fn main() {
  14. let hm = hashmap!{1 => 2, 3 => 4};
  15.  
  16. println!("{:?}", hm);
  17. }
Add Comment
Please, Sign In to add comment