Skip to main content

check_offset_section

Function check_offset_section 

Source
pub fn check_offset_section<W: ZerocopyWord>(
    offsets: &[W],
    expected_count: usize,
    value_len: usize,
) -> Result<(), OffsetIntegrityIssue>
Expand description

Validates one offset section against expected_count rows and a backing values array of length value_len.

Performs four checks: length matches expected_count + 1, first offset is zero, offsets are non-decreasing, and the final offset matches value_len. Because offsets are monotonic and the final offset equals value_len, every interior offset is implied to be <= value_len; the borrowed-view slicing in CSR/BCSR relies on that consequence and the proofs assert it directly.

§Errors

Returns the first OffsetIntegrityIssue encountered. Reports OffsetIntegrityIssue::CountOverflow when expected_count + 1 overflows.

§Performance

This function is O(offsets.len()).