#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

#430 in Data structures

Download history 2279/week @ 2024-11-21 2008/week @ 2024-11-28 1954/week @ 2024-12-05 1666/week @ 2024-12-12 1307/week @ 2024-12-19 1487/week @ 2024-12-26 1350/week @ 2025-01-02 2269/week @ 2025-01-09 2393/week @ 2025-01-16 3059/week @ 2025-01-23 3290/week @ 2025-01-30 2880/week @ 2025-02-06 2700/week @ 2025-02-13 3393/week @ 2025-02-20 3384/week @ 2025-02-27 2669/week @ 2025-03-06

12,716 downloads per month
Used in 30 crates (20 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