Expand description
Paged collections: containers whose memory is split into fixed-size pages.
Paging serves two separate purposes, and each collection states which it uses:
- Paged index. A lookup table indexed by key is split into pages that are allocated on first use, so memory follows the occupied key ranges rather than the largest key ever inserted.
- Paged storage. Elements live in fixed-size pages that never move, so references and pointers to elements stay valid while the collection grows.
§Collections
| Module | Type | Paging |
|---|---|---|
sparse_set | PagedSparseSet<K> | index; storage optional |
sparse_map | PagedSparseMap<K, V> | index; storage optional |
priority_queue | PagedPriorityQueue<K, P> | index (indexed max-heap) |
direct_map | PagedDirectMap<K, V> | index (values in place, slot order) |
bit_set | PagedBitSet<K> | index (1 bit per slot) |
paged_vec | PagedVec<T> | storage (stable addresses) |
paged_deque | PagedDeque<T> | storage (stable addresses, double-ended) |
hive | Hive<T> | storage (stable addresses, reusable slots, generational ids) |
id_alloc | IdAllocator, Id | none (free list of generational ids) |
Shared building blocks live in key (how a key maps to an index) and
page (the page directory).
§Features
std(default):std-only conveniences. Without it the crate isno_stdand needs onlyalloc.serde: serialization support.rayon: parallel iteration throughrayon::prelude. Enablesstd.concurrent: thread-safe variants inconcurrent, which useunsafecode and atomics. Includes an MPMC FIFOConcurrentQueuethat waits at page boundaries and a shardedConcurrentPriorityQueuewith relaxedpopand exactpop_exact. Off by default.
Modules§
- bit_set
PagedBitSet: a set that stores one bit per key slot in fixed-size pages.- concurrent
concurrent - Concurrent containers using the same generational ids as the plain types.
- direct_
map PagedDirectMap: a direct-address map whose values live in place in a paged index.- hive
32-bit or 64-bit Hive: an unordered container with stable addresses, reusable slots and generational handles.- id_
alloc 32-bit or 64-bit IdAllocator: hands out generationalIds and recycles freed ones.- key
- Keys and how they map to slot indices.
- page
- Page directories: where the pages of a paged index live.
- paged_
deque PagedDeque: a double-ended queue stored in fixed-size pages.- paged_
vec PagedVec: a growable vector stored in fixed-size pages.- priority_
queue PagedPriorityQueue: an indexed max-heap with a paged key index.- sparse_
map PagedSparseMap: a paged sparse set that stores one value per key.- sparse_
set PagedSparseSet: a sparse set whose sparse index is paged.