collections_macros

Crates.iocollections_macros
lib.rscollections_macros
version1.0.1
sourcesrc
created_at2022-02-17 05:19:35.356011
updated_at2022-02-17 05:25:21.402988
descriptiona collection of macros to make making collections easier
homepagehttps://github.com/lizelive/collections_macros
repositoryhttps://github.com/lizelive/collections_macros
max_upload_size
id533880
size6,105
(lizelive)

documentation

README

some macros for dicts

creates hashmap, hashset, btreeset, btreemap

map has two sytaxts

let a = 1;
let b = 2;
hashmap![
    a: a+b,
    b: b
],

is equal to

std::collections::HashMap::from([(a, a), (b, a + b)])

but if you dont include commas it acts like yml and gets names from ident

hashmap![
    a: a+b
    b: b
],

is equal to

std::collections::HashMap::from([("a", a + b), ("b", b)])
Commit count: 5

cargo fmt