mago_allocator/collections.rs
1/// The default hash builder used by the arena-backed hash collections.
2pub use hashbrown::DefaultHashBuilder;
3
4/// A hash map whose entries live in an arena.
5///
6/// The allocator slot is fixed to `&'arena A`, so construct it with
7/// [`hashbrown::HashMap::new_in`] (or `with_capacity_in`) and pass `&arena`:
8///
9/// ```ignore
10/// let mut map: HashMap<u32, u32, SharedArena> = HashMap::new_in(&arena);
11/// ```
12pub type HashMap<'arena, K, V, A, S = DefaultHashBuilder> = hashbrown::HashMap<K, V, S, &'arena A>;
13
14/// A hash set whose elements live in an arena. See [`HashMap`] for construction.
15pub type HashSet<'arena, T, A, S = DefaultHashBuilder> = hashbrown::HashSet<T, S, &'arena A>;
16
17/// A low-level hash table whose entries live in an arena. See [`HashMap`] for construction.
18pub type HashTable<'arena, T, A> = hashbrown::HashTable<T, &'arena A>;