Created
June 2, 2015 12:53
-
-
Save softprops/fa6797d0c482b4fcaafd to your computer and use it in GitHub Desktop.
map literals in rust
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
macro_rules! map( | |
{ $($key:expr => $value:expr),+ } => { | |
{ | |
let mut m = ::std::collections::HashMap::new(); | |
$( | |
m.insert($key, $value); | |
)+ | |
m | |
} | |
}; | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment