#literal #data-structure #hashmap #macro

maplit

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

9 releases (2 stable)

1.0.1 Jan 11, 2018
1.0.0 Oct 31, 2017
0.1.6 Oct 27, 2017
0.1.5 Sep 29, 2017
0.1.1 May 25, 2015

#19 in Rust patterns

Download history 6803/week @ 2018-05-27 8085/week @ 2018-06-03 7650/week @ 2018-06-10 6174/week @ 2018-06-17 7289/week @ 2018-06-24 9282/week @ 2018-07-01 8807/week @ 2018-07-08 9656/week @ 2018-07-15 11251/week @ 2018-07-22 8777/week @ 2018-07-29 9770/week @ 2018-08-05 9164/week @ 2018-08-12 8651/week @ 2018-08-19

12,654 downloads per month
Used in 160 crates (93 directly)

MIT/Apache

12KB
158 lines

maplit

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

Recent Changes

  • 1.0.1
    • Fix unused_results lint in the macros by @povilasb
  • 1.0.0
    • maplit 1.0!
    • Only documentation changes since the last version
  • 0.1.6
    • Add macro convert_args! for composable opt-in conversion of the expressions being used for the maplit macros.
  • 0.1.5
    • Add license files correctly
    • Add crates.io category
    • Small doc improvements by @seeekr and @sanmai-NL
  • 0.1.4
    • Update docs to point to docs.rs
  • 0.1.2
    • Now supports more arguments in hashset!{} and hashmap!{}
  • 0.1.0
    • Initial release

FAQ

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.

License

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