$ hashlink
v0.12.0HashMap-like containers that hold their key-value pairs in a user controllable order
Latest Update Summary
Crate
Name: hashlink New version: 0.11.0 Release date: 2025-10-26T12:42:35Z
Crate readme
Short description HashMap-like containers that hold their key-value pairs in a user controllable order.
Long description This crate is a fork of linked-hash-map that builds on top of hashbrown to implement more up to date versions of LinkedHashMap, LinkedHashSet, and LruCache. The crate contains unsafe code for handling its internal linked list, currently passes tests under miri and sanitizers, but requires further review.
Features • Efficient retrieval and insertion for LRU caching • Built on top of hashbrown • Supports LinkedHashMap and LinkedHashSet
Code Examples Basic usage
let mut lru_cache = LinkedHashMap::new();
let key = "key".to_owned();
let _cached_val = match lru_cache.raw_entry_mut().from_key(&key) {
RawEntryMut::Occupied(mut occupied) => {
occupied.to_back();
occupied.into_mut()
}
RawEntryMut::Vacant(vacant) => {
vacant.insert(key.clone(), 42).1
}
};
Simpler usage example
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));
Links • https://crates.io/crates/hashlink • https://docs.rs/hashlink • https://github.com/djc/hashlink/pull/32 • https://github.com/djc/hashlink/pull/33 • https://github.com/djc/hashlink/pull/40 • https://github.com/djc/hashlink/pull/34 • https://github.com/djc/hashlink/pull/41 https://docs.rs/hashlink https://api.github.com/repos/djc/hashlink/releases/257297727
Release info
Release version: 0.11.0
Release description In version 0.11.0 of the hashlink crate, several changes have been introduced to enhance functionality and fix issues. Notably, there was a fix for unsound Send implementations as contributed by @Icerath, which addresses critical multithreading concerns. An addition of the LruCache::retain method by @peterthejohnston improves the cache's usability. The maintainer @djc has updated the crate further with changes documented in PR #40. Additionally, the hashbrown/inline-more feature has been removed by @xacrimon, alongside an upgrade to hashbrown version 0.16 facilitated by @djc. This version marks a significant improvement in both performance and reliability, reflecting a continued commitment to maintain and enhance the library.
Code Examples Fix unsound Send impls
// Fix unsound Send implementation
#[derive(Debug, Clone)]
struct MyStruct;
unsafe impl Send for MyStruct {}
Add LruCache::retain
// Using LruCache::retain method
let mut cache = LruCache::new(5);
cache.insert("key1", "value1");
cache.retain(|&k, _| k != "key1");
Upgrade to hashbrown 0.16
// Cargo.toml dependency
hashbrown = "0.16"
Minor update: 0.11.0 → 0.12.0
$ DOWNLOADS TREND
$ VERSION HISTORY
$ LINKS
$ INSTALL
cargo add hashlinkOr add to Cargo.toml: hashlink = "0.12.0"