#literal #data-structure #hashmap #macro


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

4 stable releases

Uses old Rust 2015

1.0.5 May 24, 2023

#517 in Rust patterns

Download history 6/week @ 2023-08-16 15/week @ 2023-08-23 3/week @ 2023-08-30 13/week @ 2023-09-06 190/week @ 2023-09-13 783/week @ 2023-09-20 888/week @ 2023-09-27 912/week @ 2023-10-04 349/week @ 2023-10-11 110/week @ 2023-10-18 33/week @ 2023-10-25 29/week @ 2023-11-01 262/week @ 2023-11-08 88/week @ 2023-11-15 49/week @ 2023-11-22 267/week @ 2023-11-29

673 downloads per month


263 lines


Successor to maplit

Maplit has stopped being updated, so this is the new home for maplit improvements.


Container / collection literal macros for HashMap, HashSet, BTreeMap, BTreeSet.

You can use these for convenience. Using them has no other implications.

Please read the API documentation here

build_status crates


Question: Very large maps take a long time to compile?

Answer: Rustc is very slow to compile big expressions with many literals (including integers and float literals). Work around this by either using explicitly typed literals, or explicitly typed conversions. See https://github.com/bluss/maplit/issues/14 for more information.


Dual-licensed to be compatible with the Rust project.

Licensed under the Apache License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0 or the MIT license http://opensource.org/licenses/MIT, at your option. This file may not be copied, modified, or distributed except according to those terms.

No runtime deps