Skip to main content

Module build

Module build 

Source
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§

IdOutOfBounds
Reasons an ID failed dense bounds validation.
OffsetOverflow
Reasons a usize could 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’s usize representation is less than count.
index_from_usize
Converts a usize value into the target index width.
map_offset_overflow
Maps an OffsetOverflow into a caller-chosen error via on_overflow.
next_dense_index
Allocates the next dense ID from counter: returns counter’s current value as an Index and advances the counter by one.
slice_to_le
Lowers a native index slice into explicit little-endian storage words.
slot_or_max
Returns id’s usize representation, or usize::MAX when it does not fit in usize on the current target.