#collections #non-empty

non-empty-collections

Non-empty hash-map and hash-set implementations

8 releases

0.1.9 Sep 17, 2019
0.1.8 Aug 18, 2018
0.1.7 Jul 24, 2018

#3 in #collections

Download history 16/week @ 2019-07-20 8/week @ 2019-08-10 105/week @ 2019-08-24 11/week @ 2019-08-31 26/week @ 2019-09-07 106/week @ 2019-09-14 29/week @ 2019-09-21 10/week @ 2019-09-28 10/week @ 2019-10-05 20/week @ 2019-10-19 28/week @ 2019-10-26

132 downloads per month

MIT/Apache

44KB
1K SLoC

non-empty-collections

Non-empty hash map and hash set implementations based on [indexmap::IndexMap] and [indexmap::IndexSet] respectively, which are guaranteed to be non-empty by the type system of Rust.

pipeline status crates.io docs.rs

[Release docs]

[Master docs]

Currently not all the methods of IndexMap or IndexSet are ported to NonEmptyIndexMap and NonEmptyIndexSet, so if you are missing something, PRs are welcome! :)

Right now both implementations are too naïve: non-emptiness is achieved by declaring map and set types as a pair of an element and the rest of the collection. While the idea itself is not bad, it adds an additional overhead on basically every operation since we have to execute everything twice: on the first element and then on the rest.

License: MIT/Apache-2.0

Dependencies

~245KB