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

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

#262 in Data structures

Download history 515/week @ 2024-01-21 649/week @ 2024-01-28 619/week @ 2024-02-04 499/week @ 2024-02-11 693/week @ 2024-02-18 742/week @ 2024-02-25 834/week @ 2024-03-03 1005/week @ 2024-03-10 928/week @ 2024-03-17 893/week @ 2024-03-24 943/week @ 2024-03-31 1248/week @ 2024-04-07 1038/week @ 2024-04-14 1059/week @ 2024-04-21 1000/week @ 2024-04-28 1205/week @ 2024-05-05

4,371 downloads per month
Used in 13 crates

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