Skip to main content

Module array

Module array 

Source
Expand description

Wire-level helpers for []<elem> and nullable []<elem> arrays.

Non-flexible arrays use a 4-byte big-endian INT32 length prefix (−1 for null). Flexible (compact) arrays use an unsigned varint whose value is len + 1 (0 means null).

Functions§

array_len_prefix_len
Number of bytes consumed by a non-nullable array-length prefix.
get_array_len
Read a non-nullable array length. Returns an error if the encoded value is null (−1 / 0).
get_nullable_array_len
Read a nullable array length. Returns None when the encoded value is null (−1 non-flex, 0 flex).
nullable_array_len_prefix_len
Number of bytes consumed by a nullable array-length prefix.
put_array_len
Write a non-nullable array-length prefix.
put_nullable_array_len
Write a nullable array-length prefix. None encodes as −1 (non-flex) or 0 (flex).