Expand description
Reading and writing of messages using the standard stream framing, where each message is preceded by a segment table indicating the size of its segments.
Structs§
- 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
is similar tocrate::serialize::BufferSegments
but optimized for low memory embedded environment. It does not do heap allocations.- Information about a message read from its segment table.
- Owned memory containing a message’s segments sequentialized in a single contiguous buffer. The segments are guaranteed to be 8-byte aligned.
- Helper object for constructing an
OwnedSegments
or aSliceSegments
.
Constants§
Functions§
- Returns the number of (8-byte) words required to serialize the message (including the segment table).
- Reads a serialized message from a stream with the provided options.
- Reads a serialized message (including a segment table) from a flat slice of bytes, without copying. The slice is allowed to extend beyond the end of the message. On success, updates
slice
to point to the remaining bytes beyond the end of the message. - Reads a serialized message (including a segment table) from a flat slice of bytes, without copying. The slice is allowed to extend beyond the end of the message. On success, updates
slice
to point to the remaining bytes beyond the end of the message. - Like
read_message()
, but does not allocate. Stores the message inbuffer
. Returns aBufferNotLargeEnough
error if the buffer is not large enough. ALIGNMENT: If the “unaligned” feature is enabled, then there are no alignment requirements onbuffer
. Otherwise,buffer
must be 8-byte aligned (attempts to read the message will trigger errors). - Like
read_message()
, but returns None instead of an error if there are zero bytes left inread
. This is useful for reading a stream containing an unknown number of messages – you call this function until it returns None. - Like
try_read_message()
, but does not allocate any memory. Stores the message inbuffer
. Returns aBufferNotLargeEnough
error if the buffer is not large enough. ALIGNMENT: If the “unaligned” feature is enabled, then there are no alignment requirements onbuffer
. Otherwise,buffer
must be 8-byte aligned (attempts to read the message will trigger errors). - Writes the provided message to
write
. - Like
write_message()
, but takes aReaderSegments
, allowing it to be used onmessage::Reader
objects (viainto_segments()
). - Like
write_message_to_words()
, but takes aReaderSegments
, allowing it to be used onmessage::Reader
objects (viainto_segments()
). - Constructs a flat vector containing the entire message, including a segment header.
Type Aliases§
- Alias for the common case where the buffer in
NoAllocBufferSegments
is a u8 slice.