Crate maplit [] [src]

Macros for container literals with specific type.

#[macro_use]
extern crate maplit;

let foo = hashmap!{
    "a" => 1,
    "b" => 2,
};

The maplit crate uses => syntax for the mapping macros. It is not possible to use : as separator due to syntactic the restrictions in regular macro_rules! macros.

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

Macros

btreemap!

Create a BTreeMap from a list of key-value pairs

btreeset!

Create a BTreeSet from a list of elements.

hashmap!

Create a HashMap from a list of key-value pairs

hashset!

Create a HashSet from a list of elements.