hashmap_macro

Crates.iohashmap_macro
lib.rshashmap_macro
version0.1.0
sourcesrc
created_at2022-09-30 06:40:25.944248
updated_at2022-09-30 06:40:25.944248
descriptionhashmap macro for creating hashmap from provided key/value pairs
homepagehttps://github.com/wholesome-ghoul/hashmap_macro
repositoryhttps://github.com/wholesome-ghoul/hashmap_macro
max_upload_size
id677108
size4,294
(wholesome-ghoul)

documentation

https://docs.rs/hashmap_macro

README

HashMap Macro

Creates a HashMap from provided key/value pairs.

Usage

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

Commit count: 1

cargo fmt