#declarative-macro #macro #collection

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

#616 in Rust patterns

Download history 720/week @ 2024-07-17 1186/week @ 2024-07-24 906/week @ 2024-07-31 809/week @ 2024-08-07 874/week @ 2024-08-14 719/week @ 2024-08-21 972/week @ 2024-08-28 1975/week @ 2024-09-04 1490/week @ 2024-09-11 1638/week @ 2024-09-18 2047/week @ 2024-09-25 2077/week @ 2024-10-02 2067/week @ 2024-10-09 2409/week @ 2024-10-16 1873/week @ 2024-10-23 1884/week @ 2024-10-30

8,627 downloads per month
Used in 25 crates (15 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