Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lizelive/collections_macros
https://github.com/lizelive/collections_macros
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/lizelive/collections_macros
- Owner: lizelive
- Created: 2022-02-17T05:18:04.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-02-17T05:24:42.000Z (almost 3 years ago)
- Last Synced: 2024-10-11T15:10:50.103Z (3 months ago)
- Language: Rust
- Size: 6.84 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
some macros for dicts
creates `hashmap`, `hashset`, `btreeset`, `btreemap`
map has two sytaxts
```rust
let a = 1;
let b = 2;
hashmap![
a: a+b,
b: b
],
```
is equal to
```rust
std::collections::HashMap::from([(a, a), (b, a + b)])
```but if you dont include commas it acts like yml and gets names from ident
```rust
hashmap![
a: a+b
b: b
],
```
is equal to
```rust
std::collections::HashMap::from([("a", a + b), ("b", b)])
```