Skip to main content

Crate oxgraph_layout_util

Crate oxgraph_layout_util 

Source
Expand description

Shared layout primitives for OxGraph graph and hypergraph crates.

Two responsibilities live here:

Helpers return small typed data enums (IdOutOfBounds, OffsetOverflow, OffsetIntegrityIssue) instead of crate-specific error types. Callers map the issue to their own typed error at the boundary.

no_std + alloc (build-time primitives need Vec). No public domain semantics. No dependency on any other oxgraph crate.

Enums§

IdOutOfBounds
Reasons an ID failed dense bounds validation.
OffsetIntegrityIssue
Reasons a borrowed offset or value array failed structural validation.
OffsetOverflow
Reasons a usize could not be represented in a target index width during builder offset construction.

Traits§

BuildIndex
Unsigned dense ID width usable by graph and hypergraph builders.
ZerocopyWord
Borrowed offset or value word usable by offset-integrity primitives.

Functions§

build_offset_index
Flattens per-bucket payloads into a (offsets, items) pair.
check_offset_section
Validates one offset section against expected_count rows and a backing values array of length value_len.
check_offsets_monotonic
Verifies offsets[0] == 0 and that offsets is non-decreasing.
check_value_range
Verifies every value in values is less than bound.
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.
slot_or_max
Returns id’s usize representation, or usize::MAX when it does not fit in usize on the current target.