Skip to main content

offset_slice_memory_size

Function offset_slice_memory_size 

Source
fn offset_slice_memory_size<O: OffsetSizeTrait>(
    len: usize,
    offsets: &[O],
    validity_size: usize,
) -> Option<usize>
Expand description

Returns (len + 1) * offset_width + (offsets[len] - offsets[0]) + validity_size, or None on overflow.

offsets are the offsets of the visible slice, so offsets[0] is the first visible byte and offsets[len] is the end of the last visible value. The offsets buffer size is checked before offsets[len] is read, so a len that cannot come from a valid offsets buffer is reported as an overflow instead of panicking.