axhash-map
High-performance HashMap and HashSet for Rust powered by hashbrown and axhash.
- SwissTable-based layout via
hashbrown - AES-accelerated hashing
- Fast drop-in replacement for standard hash collections
- Serde-friendly type aliases
- Deterministic hashing by default
Installation
[]
= "0.1"
AES acceleration is selected automatically at runtime.
Usage
Type alias (HashMap / HashSet)
Best for Serde and drop-in compatibility.
use HashMap;
let mut map: = default;
map.insert;
map.insert;
assert_eq!;
Branded types (AxHashMap / AxHashSet)
Provides convenient constructors like new() and with_capacity().
use AxHashMap;
let mut map: = new;
map.insert;
assert_eq!;
HashSet
use AxHashSet;
let mut set: = new;
set.insert;
set.insert;
set.insert;
assert_eq!;
assert!;
Constructors
use ;
let map = new;
let map =
with_capacity;
let seed = 0xdeadbeef_cafebabe;
let map: =
with_hasher;
Entry API
use AxHashMap;
let mut map: = new;
map.entry
.and_modify
.or_insert;
map.entry
.and_modify
.or_insert;
assert_eq!;
Iterators & Extend
use ;
let map: =
.into_iter
.collect;
let set: =
.into_iter
.collect;
Raw hashbrown interoperability
use BuildHasherDefault;
use ;
let raw: = with_hasher;
let wrapped: = raw.into;
Custom seed
Use a random seed when handling untrusted external input.
use ;
let seed = 0x1234_5678_9abc_def0;
let map: = with_hasher;
Links
- Crate: https://crates.io/crates/axhash-map
- Docs: https://docs.rs/axhash-map
- hashbrown: https://crates.io/crates/hashbrown
- axhash: https://crates.io/crates/axhash
License
MIT