8 releases
0.1.6 | Nov 5, 2024 |
---|---|
0.1.5 | Feb 27, 2023 |
0.1.4 | Jul 5, 2019 |
0.1.3 | Feb 26, 2017 |
0.0.1 | Aug 27, 2016 |
#528 in Data structures
138 downloads per month
Used in 2 crates
(via addressable-pairing-heap)
50KB
1K
SLoC
Stash
Stash is a library for storing items where you need (amortized) O(1)
insertion, deletion, and lookups but don't care about the order of the items and
don't need to be able to choose the keys.
Please see the API documentation for a more detailed description.
Authors
- Steven Allen steven@stebalien.com
- Robbepop robbepop@web.de
- Shane Pearman spearman@github.com
- Simon Persson simon.persson@mykolab.com
lib.rs
:
Stash is a library for efficiently storing maps of keys to values when one
doesn't care what the keys are but wants blazing† fast O(1)
insertions, deletions, and lookups.
Common use cases include file descriptor tables, session tables, or MIO context tables.
†Blazing means an order of magnitude faster than hash maps and btree maps.
Serialization
A stash can be serialized and deserialized with serde, preserving its existing key/value mapping. This can be used to save/restore a stash to persistant storage.
However, in general, stashes make no guarantees on how keys are assigned. If stash A is serialized then deserialized into stash B, values inserted into stash A will likely be assigned different keys than values inserted into stash B.
Dependencies
~170KB