#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

#1297 in Data structures

Download history 3978/week @ 2025-12-05 3717/week @ 2025-12-12 2435/week @ 2025-12-19 2692/week @ 2025-12-26 3399/week @ 2026-01-02 4086/week @ 2026-01-09 5053/week @ 2026-01-16 4593/week @ 2026-01-23 8296/week @ 2026-01-30 4029/week @ 2026-02-06 4501/week @ 2026-02-13 5736/week @ 2026-02-20 7281/week @ 2026-02-27 10298/week @ 2026-03-06 8179/week @ 2026-03-13 10826/week @ 2026-03-20

37,744 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