zserio.builtin module

The module provides implementation of zserio built-in operators.

zserio.builtin.isset(bitmask_value: Any, required_mask: Any) bool[source]

Checks whether the required_mask is set within the bitmask_value.

This method implements zserio built-in operator isset.

Parameters:
  • bitmask_value – Bitmask value to check.

  • required_mask – Mask to use.

Returns:

True when the required_mask is set within the bitmask_value, False otherwise.

zserio.builtin.lengthof_string(string: str) int[source]

Gets length of the given string in UTF-8 bytes.

Parameters:

string – String value.

Returns:

Number of bytes needed to encode given string in UTF-8.

zserio.builtin.numbits(num_values: int) int[source]

Gets the minimum number of bits required to encode given number of different values.

This method implements zserio built-in operator numBits.

Parameters:

num_values – The number of different values from which to calculate number of bits.

Returns:

Number of bits required to encode num_values different values.