Skip to content

lizelive/collections_macros

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)])