hashmap_macro 0.1.0

hashmap macro for creating hashmap from provided key/value pairs
Documentation
  • Coverage
  • 50%
    1 out of 2 items documented1 out of 1 items with examples
  • Size
  • Source code size: 3.97 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 116.88 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Homepage
  • wholesome-ghoul/hashmap_macro
    8 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • wholesome-ghoul

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