Module encoding

Source
Expand description

Frame encoding to convert a data stream into packets. It can be used as a utility to build adapters.

Structs§

Decoder
Used to decoded messages from several/partial data chunks

Constants§

MAX_ENCODED_SIZE
This is the max required bytes to encode a u64 using the varint encoding scheme. It is size 10=ceil(64/7)

Functions§

decode_size
Decodes an encoded value in a buffer. The function returns the message size and the consumed bytes or none if the buffer is too small.
encode_size
Encode a message, returning the bytes that must be sent before the message. A buffer is used to avoid heap allocation.