Expand description
Build-time layout primitives.
Builders validate dense IDs against a known count (id_to_slot,
slot_or_max), convert usize slots back into a typed index width
(index_from_usize, next_dense_index), flatten per-bucket payloads
into CSR-style (offsets, items) pairs (build_offset_index), and lower
native index slices into explicit little-endian words (slice_to_le).
Helpers return small typed data enums (IdOutOfBounds, OffsetOverflow)
instead of crate-specific error types; callers map the issue to their own
typed error at the boundary (map_offset_overflow).
Enums§
- IdOut
OfBounds - Reasons an ID failed dense bounds validation.
- Offset
Overflow - Reasons a
usizecould not be represented in a target index width during builder offset construction.
Functions§
- build_
offset_ index - Flattens per-bucket payloads into a
(offsets, items)pair. - id_
to_ slot - Validates that
id’susizerepresentation is less thancount. - index_
from_ usize - Converts a
usizevalue into the target index width. - map_
offset_ overflow - Maps an
OffsetOverflowinto a caller-chosen error viaon_overflow. - next_
dense_ index - Allocates the next dense ID from
counter: returnscounter’s current value as anIndexand advances the counter by one. - slice_
to_ le - Lowers a native index slice into explicit little-endian storage words.
- slot_
or_ max - Returns
id’susizerepresentation, orusize::MAXwhen it does not fit inusizeon the current target.