map 1.3.0

This crate provides the `map!` macro and `map_insert!` macro, to create a HashMap collection and insert key-value pairs. Inspired by the `vec!` macro.
Documentation
  • Coverage
  • 57.14%
    4 out of 7 items documented3 out of 3 items with examples
  • Size
  • Source code size: 12 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.31 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 8s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • joelparkerhenderson

map! macro Rust crate

This crate provides map! macros to create map collections and insert key-value pairs. This is inspired by the vec! macro.

map! macro

Create a new map collection and insert key-value pairs.

Example with tuple syntax:

let m = map!((1, 2), (3, 4));

Example with arrow syntax:

let m = map!(1 => 2, 3 => 4);

Equivalent Rust standard code:

let mut m = HashMap::new();
m.insert(1, 2);
m.insert(3, 4);

map_insert! macro

Use an existing map collection and insert key-value pairs.

Example with tuple syntax:

let mut m = HashMap::new();
map_insert!(m, (1, 2), (3, 4));

Example with arrow syntax:

let mut m = HashMap::new();
map_insert!(m, 1 => 2, 3 => 4);

Equivalent Rust std code with method insert:

let mut m = HashMap::new();
m.insert(1, 2);
m.insert(3, 4);

map_remove! macro

Use an existing map collection and remove key-value pairs.

Example with tuple syntax:

let mut m = HashMap::from([(1, 2), (3, 4)]);
map_remove!(m, &1, &3);

Equivalent Rust std code with method remove:

let mut m = HashMap::from([(1, 2), (3, 4)]);
m.remove(&1);
m.remove(&3);