Created
August 18, 2018 11:55
-
-
Save heypoom/35874f2f97cb7df669869bfa6fee007a to your computer and use it in GitHub Desktop.
This file contains hidden or 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! mapping { | |
( $($key:expr => $value:expr),* ) => { | |
{ | |
let mut m = HashMap::new(); | |
$( | |
m.insert($key, $value); | |
)* | |
m | |
} | |
}; | |
} | |
fn main() { | |
let me = mapping!("foo" => "bar", "bar" => "baz"); | |
println!("{:?}", me); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment