#lookup-tables #key #insertion #key-value #table #dont

no-std stash

An amortized O(1) table for cases where you don’t need to choose the keys and want something faster than a HashTable

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

#524 in Data structures

Download history 27/week @ 2024-07-27 2/week @ 2024-08-03 2/week @ 2024-08-10 2/week @ 2024-08-31 6/week @ 2024-09-21 14/week @ 2024-09-28 6/week @ 2024-10-05 1/week @ 2024-10-12 121/week @ 2024-11-02 13/week @ 2024-11-09

134 downloads per month
Used in 2 crates (via addressable-pairing-heap)

MIT/Apache

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


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

~175KB