Created
August 18, 2018 11:58
-
-
Save heypoom/60417621aa503094285f47e431aed59b 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
use std::collections::HashMap; | |
macro_rules! mapping { | |
( $key:expr => $value:expr ) => {{ | |
let mut m = HashMap::new(); | |
m.insert($key, $value); | |
m | |
}}; | |
} | |
fn main() { | |
let x = mapping!("foo" => "bar"); | |
println!("{:?}", x); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment