lit2 1.0.9

Collection helper libraries and “literal” macros for HashMap, HashSet, BTreeMap, and BTreeSet.
Documentation

Macros for container literals with specific type.

use lit2::*;

# fn main() {
let map = hashmap!{
"a" => 1,
"b" => 2,
};

let set = set!{1, 2, 3};
# }

The lit2 crate uses => syntax to separate the key and value for the mapping macros. It is also possible to use the : separator, but the keys cannot be expressions.

Note that rust macros are flexible in which brackets you use for the invocation. You can use them as hashmap!{} or hashmap![] or hashmap!().

Generic container macros already exist elsewhere, so those are not provided here at the moment.