varint_serializers

varint_serializers#

Full path: iqm.station_control.client.serializers.varint_serializers

Helpers for protobuf-style varint serialization.

Protobuf automatically varint-encodes integer values inside a message body. These functions are needed when a varint must appear outside any message - for example, as a length prefix in a hand-assembled byte stream - where the protobuf library has no opportunity to perform the encoding automatically.

Functions

decode_varint(buffer, offset)

Decode a protobuf varint from buffer starting at offset.

encode_varint(value)

Encode a non-negative integer using protobuf varint encoding.