Skip to content

Instantly share code, notes, and snippets.

@softprops
Created June 2, 2015 12:53
Show Gist options
  • Save softprops/fa6797d0c482b4fcaafd to your computer and use it in GitHub Desktop.
Save softprops/fa6797d0c482b4fcaafd to your computer and use it in GitHub Desktop.
map literals in rust
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