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, and −1 means null. Flexible, compact arrays use an unsigned varint whose value is len + 1, and 0 means null.

Functions§

array_len_prefix_len
Number of bytes consumed by a non-nullable array-length prefix.
get_array_len
Reads a non-nullable array length. Returns an error if the encoded value is null, which is −1 or 0.
get_nullable_array_len
Reads a nullable array length. Returns None when the encoded value is null, which is −1 for non-flexible versions and 0 for flexible versions.
nullable_array_len_prefix_len
Number of bytes consumed by a nullable array-length prefix.
put_array_len
Writes a non-nullable array-length prefix.
put_nullable_array_len
Writes a nullable array-length prefix. None encodes as −1 for non-flexible versions, or 0 for flexible versions.