#declarative-macro #collection #hash-map #macro #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

#556 in Data structures

Download history 1204/week @ 2024-04-05 1134/week @ 2024-04-12 906/week @ 2024-04-19 1104/week @ 2024-04-26 1232/week @ 2024-05-03 1103/week @ 2024-05-10 1553/week @ 2024-05-17 1403/week @ 2024-05-24 1052/week @ 2024-05-31 697/week @ 2024-06-07 695/week @ 2024-06-14 902/week @ 2024-06-21 883/week @ 2024-06-28 919/week @ 2024-07-05 802/week @ 2024-07-12 715/week @ 2024-07-19

3,465 downloads per month
Used in 14 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