mirror of
https://github.com/LukasKalbertodt/programmieren-in-rust.git
synced 2025-06-29 00:07:31 +02:00
Rename sheet folders to assure proper sorting
This commit is contained in:
15
aufgaben/sheet09/sol3/map.rs
Executable file
15
aufgaben/sheet09/sol3/map.rs
Executable file
@ -0,0 +1,15 @@
|
||||
|
||||
macro_rules! hash_map {
|
||||
( $($key:expr => $value:expr ,)* ) => {{
|
||||
let mut map = ::std::collections::HashMap::new();
|
||||
$( map.insert($key, $value); )*
|
||||
map
|
||||
}};
|
||||
( $($key:expr => $value:expr),* ) => { hash_map!($($key => $value ,)*) };
|
||||
}
|
||||
|
||||
|
||||
fn main() {
|
||||
let ages = hash_map!{ "Sabine" => 26, "Peter" => 32 };
|
||||
println!("{:#?}", ages);
|
||||
}
|
Reference in New Issue
Block a user