exprotobuf v1.1.0 Protobuf.Delimited
Handles serialization/deserialization of multi-message encoded binaries.
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
Functions
Specs
decode(binary, atom) :: [Map.t] | {:error, term}
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.
Specs
encode([Map.t]) :: binary
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, ..>>