Skip to content

Instantly share code, notes, and snippets.

@heypoom
Created August 18, 2018 11:58
Show Gist options
  • Save heypoom/60417621aa503094285f47e431aed59b to your computer and use it in GitHub Desktop.
Save heypoom/60417621aa503094285f47e431aed59b to your computer and use it in GitHub Desktop.
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