idmap/
direct.rs

1//! Direct maps and set, which take storage proportional to the maximum id.
2//!
3//! This is roughly equivalent to a `Vec<Option<T>>` for the map and bitset for the set.
4
5pub(crate) mod macros;
6pub mod map;
7#[cfg(feature = "serde")]
8mod serde;
9pub mod set;
10
11pub use self::map::DirectIdMap;
12pub use self::set::DirectIdSet;
13use intid::uint::UnsignedPrimInt;
14
15/// Panic indicating that an id would exhaust available memory.
16#[inline(never)]
17#[track_caller]
18#[cold]
19fn oom_id(id: impl UnsignedPrimInt) -> ! {
20    panic!(
21        "Storing id would exhaust memory: {}",
22        intid::uint::debug_desc(id),
23    )
24}