1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//! 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 is `no_std`
//! and needs only `alloc`.
//! - `serde`: serialization support.
//! - `rayon`: parallel iteration through `rayon::prelude`. Enables `std`.
//! - `concurrent`: thread-safe variants in [`concurrent`], which use `unsafe`
//! code and atomics. Includes an MPMC FIFO `ConcurrentQueue` that waits at
//! page boundaries and a sharded `ConcurrentPriorityQueue` with relaxed
//! `pop` and exact `pop_exact`. Off by default.
extern crate alloc;
extern crate std;
// Needs pointer-sized and 64-bit atomics, and `u32` indices that fit `usize`.
// Slot indices are `u32` and must convert to `usize` without loss.
// Indices are `u32` and must convert to `usize` without loss.
// Runs the README's Rust examples as doctests.
;