Skip to main content

Crate robinxx_map

Crate robinxx_map 

Source
Expand description

§robinxx_map

High-performance, thread-safe open-addressing hash map utilizing Robin Hood displacement with Distance from Home (DfH) tracking and xxHash3 for key hashing.

Designed for #![no_std] environments with explicit alloc support, and guarantees Send + Sync across all targets via an internal atomic spinlock. All public APIs are strictly safe, with internal unsafe blocks confined to allocation, probing, and memory layout manipulation.

§Architecture

  • SoA Layout: Metadata, keys, and values are stored in parallel 64B-aligned arrays.
  • Robin Hood Probing: Displaces entries with lower DfH to bound probe chains.
  • Zero-Dependency Core: Relies only on xxhash-rust for stable hashing.

§Example

use robinxx_map::RobinHoodMap;

// Defaults to Global allocator when `std` is available.
let mut map = RobinHoodMap::<&str, i32>::new();
map.insert("key".into(), 42);
assert_eq!(map.with_key(&"key".into(), |v| *v), Some(42));

§Safety & Compliance

  • Public API is 100% safe. unsafe is documented with # Safety invariants.
  • Strict rustdoc enforcement (-D warnings) and ≥90% internal logic coverage.
  • MSRV: 1.95.0 | Edition: 2024

Re-exports§

pub use hash::RobinHoodKey;
pub use map::RobinHoodMap;

Modules§

entry
Entry API for in-place modification and conditional insertion.
hash
Hashing primitives and xxhash-rust wrapper for RobinHoodKey trait.
iter
Safe traversal iterators: Iter, IterMut, Keys, Values, Drain.
map
Safe public API surface for RobinHoodMap<K, V>.
memory
Memory layout calculation, alignment enforcement, and allocation.
sync
Concurrency primitives for no_std thread-safety.
table
Low-level RawTable implementation: probing, insert, erase, resize, and DfH logic.