Crates.io | hashmap_macro |
lib.rs | hashmap_macro |
version | 0.1.0 |
source | src |
created_at | 2022-09-30 06:40:25.944248 |
updated_at | 2022-09-30 06:40:25.944248 |
description | hashmap macro for creating hashmap from provided key/value pairs |
homepage | https://github.com/wholesome-ghoul/hashmap_macro |
repository | https://github.com/wholesome-ghoul/hashmap_macro |
max_upload_size | |
id | 677108 |
size | 4,294 |
Creates a HashMap from provided key/value pairs.
use std::collections::HashMap;
use hashmap_macro::hashmap;
let m: HashMap<&str, u32> = hashmap![];
let m: HashMap<&str, u32> = hashmap!("a" => 1);
let m: HashMap<&str, u32> = hashmap! {
"a" => 1,
"b" => 2,
};
Inspired by Jon Gjengset's Crust of Rust: Declarative Macros