Skip to main content

build_views

Function build_views 

Source
pub fn build_views<P: NativePType + AsPrimitive<usize>>(
    start_buf_index: u32,
    max_buffer_len: usize,
    bytes: ByteBuffer,
    lens: &[P],
) -> (Vec<ByteBuffer>, Buffer<BinaryView>)
Expand description

Split a large buffer of input bytes holding string data into VarBinView buffers and views.

The values must be laid end-to-end in bytes, one per entry of lens, describing the whole buffer exactly. The returned buffers are zero-copy slices of bytes, numbered sequentially from start_buf_index.

max_buffer_len must not exceed MAX_BUFFER_LEN, since every view offset is stored in a u32 and offsets are bounded by max_buffer_len.

ยงPanics

Panics if the lengths do not describe bytes exactly, or if a single value exceeds max_buffer_len.