exprotobuf v1.2.16 Protobuf.Delimited
Handles serialization/deserialization of multi-message encoded binaries.
Link to this section Summary
Functions
Decodes one or more messages in a delimited, encoded binary.
Loops over messages and encodes them. Also creates a final byte stream which contains the messages delimited by their byte size.
Link to this section Functions
Link to this function
decode(bytes, module)
Decodes one or more messages in a delimited, encoded binary.
Input binary should have the following layout:
<<byte_size_m1::size(32), m1::bytes-size(byte_size_m1), ..>>
Output will be a list of decoded messages, in the order they appear in the input binary. If an error occurs, an error tuple will be returned.
Link to this function
encode(messages)
Loops over messages and encodes them. Also creates a final byte stream which contains the messages delimited by their byte size.
Example
input = [m1, m2, m3]
output = <<byte_size(encoded_m1), encoded_m1, byte_size(encoded_m2), encoded_m2, ..>>