allocate/collections/mod.rs
1//! Allocator-aware collections.
2//!
3//! - [`HashMap<K, V, A>`] — type alias for
4//! `hashbrown::HashMap<K, V, DefaultHashBuilder, A>`. Unordered
5//! iteration; allocator-aware on stable via hashbrown's
6//! `allocator-api2` feature.
7//!
8//! No allocator-aware `BTreeMap`: there's no stable impl, and no
9//! current consumer parameterises BTreeMap by allocator. Callers that
10//! want ordered iteration can sort a HashMap iterator at consumption
11//! time.
12
13pub use hashbrown::DefaultHashBuilder;
14
15use crate::Global;
16
17/// SwissTable hash map. Re-export of `hashbrown::HashMap<K, V, S, A>`
18/// with the upstream parameter order preserved: `K, V, S, A`. The
19/// `S` slot lets callers pin a deterministic hasher (e.g.
20/// `foldhash::fast::FixedState`) which the shared-memory state cache
21/// requires; the heap-backed default `DefaultHashBuilder` is
22/// `foldhash::fast::RandomState`.
23pub type HashMap<K, V, S = DefaultHashBuilder, A = Global> = hashbrown::HashMap<K, V, S, A>;
24
25#[cfg(test)]
26mod hashmap_tests;