Skip to main content

Module integrity

Module integrity 

Source
Expand description

Read-time offset-integrity primitives.

View-open validation walks borrowed offset and value arrays (check_offsets_monotonic, check_value_range, check_offset_section) and converts already-validated indexes infallibly (index_to_usize_validated, usize_to_index_validated).

Helpers return the small typed OffsetIntegrityIssue enum instead of crate-specific error types; callers map the issue to their own typed error at the boundary.

Enums§

OffsetIntegrityIssue
Reasons a borrowed offset or value array failed structural validation.

Functions§

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.
index_to_usize_validated
Converts an already-validated index into usize.
usize_to_index_validated
Converts an already-validated usize slot into the target index width.