Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/psiace/ritelinked
RiteLinked - LinkedHashMap & LinkedHashSet in Rust
https://github.com/psiace/ritelinked
data-structures hash hashmap hashset indexmap linked-hash-map linked-hash-set rust
Last synced: about 2 months ago
JSON representation
RiteLinked - LinkedHashMap & LinkedHashSet in Rust
- Host: GitHub
- URL: https://github.com/psiace/ritelinked
- Owner: PsiACE
- License: apache-2.0
- Created: 2021-03-03T17:11:57.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-10-23T22:57:26.000Z (about 1 year ago)
- Last Synced: 2024-10-12T17:29:39.217Z (2 months ago)
- Topics: data-structures, hash, hashmap, hashset, indexmap, linked-hash-map, linked-hash-set, rust
- Language: Rust
- Homepage: https://crates.io/crates/ritelinked
- Size: 118 KB
- Stars: 53
- Watchers: 2
- Forks: 3
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
RiteLinked
HashMap-like containers that hold their key-value pairs in a user controllable order
[![Latest Version](https://img.shields.io/crates/v/ritelinked.svg)](https://crates.io/crates/ritelinked)
[![API Documentation](https://docs.rs/ritelinked/badge.svg)](https://docs.rs/ritelinked)[RiteLinked](https://crates.io/crates/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`:
```toml
ritelinked = "x.y.z"
```Write some code like this:
``` rust
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: [140.15 ns 141.06 ns 142.15 ns]
Found 11 outliers among 100 measurements (11.00%)
8 (8.00%) high mild
3 (3.00%) high severehashlink time: [147.01 ns 147.87 ns 148.75 ns]
Found 11 outliers among 100 measurements (11.00%)
4 (4.00%) high mild
7 (7.00%) high severelinked-hash-map time: [301.44 ns 309.86 ns 319.40 ns]
Found 12 outliers among 100 measurements (12.00%)
9 (9.00%) high mild
3 (3.00%) high severe
```## Credit
It is a fork of the popular crate [hashlink](https://crates.io/crates/hashlink), but more adjustments and improvements have been made to the code .
## License
This library is licensed the same as [hashlink](https://github.com/kyren/hashlink),
it is licensed under either of:* MIT license [LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT
* Apache License 2.0 [LICENSE-APACHE](LICENSE-APACHE) or https://opensource.org/licenses/Apache-2.0at your option.