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 mod map;
6#[cfg(feature = "serde")]
7mod serde;
8pub mod set;
9
10pub use self::map::DirectIdMap;
11pub use self::set::DirectIdSet;
12use intid::uint::UnsignedPrimInt;
13
14/// Panic indicating that an id would exhaust available memory.
15#[inline(never)]
16#[track_caller]
17#[cold]
18fn oom_id(id: impl UnsignedPrimInt) -> ! {
19    panic!(
20        "Storing id would exhaust memory: {}",
21        intid::uint::debug_desc(id),
22    )
23}