#no-std #linked-hash-map #amortized #linked-hash-set

no-std ritelinked

HashMap-like containers that hold their key-value pairs in a user controllable order

7 releases

0.3.2 Aug 24, 2021
0.3.1 May 27, 2021
0.2.2 Mar 6, 2021
0.1.0 Mar 3, 2021

#540 in Data structures

Download history 3343/week @ 2023-10-17 3734/week @ 2023-10-24 2959/week @ 2023-10-31 3534/week @ 2023-11-07 3717/week @ 2023-11-14 2837/week @ 2023-11-21 3810/week @ 2023-11-28 3812/week @ 2023-12-05 3649/week @ 2023-12-12 2441/week @ 2023-12-19 1873/week @ 2023-12-26 2808/week @ 2024-01-02 3892/week @ 2024-01-09 4624/week @ 2024-01-16 3868/week @ 2024-01-23 3388/week @ 2024-01-30

16,495 downloads per month
Used in 29 crates (9 directly)

MIT/Apache

93KB
2.5K SLoC

RiteLinked -- HashMap-like containers that hold their key-value pairs in a user controllable order

Latest Version API Documentation

RiteLinked provides more up to date versions of LinkedHashMap & LinkedHashSet . You can easily use it on std or no_std environment.

Support some practical feature combinations to help you better embed them in existing code: serde, inline-more etc. Especially, it uses griddle by default, if you have a lot of data, it can effectively help you reduce the possible tail delay. (Of course, hashbrown can also be used)

Usage

Add ritelinked to Cargo.toml:

ritelinked = "x.y.z"

Write some code like this:

let mut lru_cache = LinkedHashMap::new();
let key = "key".to_owned();
let _cached_val = lru_cache
    .raw_entry_mut()
    .from_key(&key)
    .or_insert_with(|| (key.clone(), 42));

Benchmark

ritelinked              time:   [165.09 ns 165.40 ns 165.79 ns]                       
Found 12 outliers among 100 measurements (12.00%)
  5 (5.00%) high mild
  7 (7.00%) high severe

hashlink                time:   [168.11 ns 168.48 ns 168.96 ns]                     
Found 13 outliers among 100 measurements (13.00%)
  2 (2.00%) high mild
  11 (11.00%) high severe

linked-hash-map         time:   [370.98 ns 382.59 ns 397.44 ns]                            
Found 7 outliers among 100 measurements (7.00%)
  7 (7.00%) high mild

Credit

It is a fork of the popular crate hashlink, but more adjustments and improvements have been made to the code .

License

This library is licensed the same as hashlink, it is licensed under either of:

at your option.

Dependencies

~0.8–1.1MB
~17K SLoC