#vec #hash-map #collection #hash-set #macro

no-std map-macro

Declarative macros for statically initializing collections

9 releases

0.3.0 Jan 29, 2024
0.2.6 Apr 22, 2023
0.2.5 Dec 15, 2022
0.2.4 Aug 18, 2022
0.1.0 May 11, 2021

#1465 in Data structures

Download history 5264/week @ 2026-01-15 3642/week @ 2026-01-22 9103/week @ 2026-01-29 3959/week @ 2026-02-05 4240/week @ 2026-02-12 5724/week @ 2026-02-19 7520/week @ 2026-02-26 9516/week @ 2026-03-05 7631/week @ 2026-03-12 11381/week @ 2026-03-19 9271/week @ 2026-03-26 7215/week @ 2026-04-02 11376/week @ 2026-04-09 9693/week @ 2026-04-16 9515/week @ 2026-04-23 7002/week @ 2026-04-30

39,341 downloads per month
Used in 35 crates (25 directly)

MIT license

26KB
216 lines

map-macro

Build Status Latest Version Downloads Docs License: MIT

This crate offers declarative macros for initializing collections from the standard library and hashbrown.

This crate has zero dependencies and is #![no_std] if you opt-out of support for the standard library collections.

Example

use map_macro::hash_map;

let hello = hash_map! {
    "en" => "Hello",
    "de" => "Hallo",
    "fr" => "Bonjour",
    "es" => "Hola",
    "cat" => "Hola",
    "🌍" => "👋",
};

Dependencies