https://github.com/jofas/map_macro
Declarative macros for statically initializing collections with ease
https://github.com/jofas/map_macro
collections hashbrown hashmap hashset macros map no-std rust rust-crate set
Last synced: 9 months ago
JSON representation
Declarative macros for statically initializing collections with ease
- Host: GitHub
- URL: https://github.com/jofas/map_macro
- Owner: jofas
- License: other
- Created: 2021-05-11T15:09:37.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-01-29T15:58:51.000Z (almost 2 years ago)
- Last Synced: 2025-04-09T23:03:02.766Z (9 months ago)
- Topics: collections, hashbrown, hashmap, hashset, macros, map, no-std, rust, rust-crate, set
- Language: Rust
- Homepage:
- Size: 76.2 KB
- Stars: 23
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# map-macro
[](https://github.com/jofas/map_macro/actions/workflows/build.yml)
[](https://crates.io/crates/map-macro)
[](https://crates.io/crates/map-macro)
[](https://docs.rs/map-macro/latest/map_macro)
[](https://opensource.org/licenses/MIT)
This crate offers declarative macros for initializing collections from the
[standard library][std] and [hashbrown][hashbrown].
This crate has zero dependencies and is `#![no_std]` if you opt-out of
support for the standard library collections.
## Example
```rust
use map_macro::hash_map;
let hello = hash_map! {
"en" => "Hello",
"de" => "Hallo",
"fr" => "Bonjour",
"es" => "Hola",
"cat" => "Hola",
"🌍" => "👋",
};
```
[std]: https://doc.rust-lang.org/std/collections/index.html
[hashbrown]: https://docs.rs/hashbrown/latest/hashbrown/