Module serialize

Source
Expand description

Reading and writing of messages using the standard stream framing.

Each message is preceded by a segment table indicating the size of its segments.

Structs§

BufferSegments
Segments read from a buffer, useful for when you have the message in a buffer and don’t want the extra copy performed by read_message.
NoAllocBufferSegments
NoAllocBufferSegments is similar to crate::serialize::BufferSegments but optimized for low memory embedded environment. It does not do heap allocations.
NoAllocSegmentTableInfo
Information about a message read from its segment table.
OwnedSegments
Owned memory containing a message’s segments sequentialized in a single contiguous buffer. The segments are guaranteed to be 8-byte aligned.
SegmentLengthsBuilder
Helper object for constructing an OwnedSegments or a SliceSegments.

Constants§

SEGMENTS_COUNT_LIMIT

Functions§

compute_serialized_size_in_words
Returns the number of (8-byte) words required to serialize the message (including the segment table).
read_message
Reads a serialized message from a stream with the provided options.
read_message_from_flat_slice
Reads a serialized message (including a segment table) from a flat slice of bytes, without copying.
read_message_from_flat_slice_no_alloc
Reads a serialized message (including a segment table) from a flat slice of bytes, without copying.
read_message_no_alloc
Like read_message(), but does not allocate.
try_read_message
Like read_message(), but returns None instead of an error if there are zero bytes left in read.
try_read_message_no_alloc
Like try_read_message(), but does not allocate any memory.
write_message
Writes the provided message to write.
write_message_segments
Like write_message(), but takes a ReaderSegments, allowing it to be used on message::Reader objects (via into_segments()).
write_message_segments_to_words
Like write_message_to_words(), but takes a ReaderSegments, allowing it to be used on message::Reader objects (via into_segments()).
write_message_to_words
Constructs a flat vector containing the entire message, including a segment header.

Type Aliases§

NoAllocSliceSegments
Alias for the common case where the buffer in NoAllocBufferSegments is a u8 slice.