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§
- Buffer
Segments - 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. - NoAlloc
Buffer Segments NoAllocBufferSegmentsis similar tocrate::serialize::BufferSegmentsbut optimized for low memory embedded environment. It does not do heap allocations.- NoAlloc
Segment Table Info - Information about a message read from its segment table.
- Owned
Segments - Owned memory containing a message’s segments sequentialized in a single contiguous buffer. The segments are guaranteed to be 8-byte aligned.
- Segment
Lengths Builder - Helper object for constructing an
OwnedSegmentsor aSliceSegments.
Constants§
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 inread. - 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 aReaderSegments, allowing it to be used onmessage::Readerobjects (viainto_segments()). - write_
message_ segments_ to_ words - Like
write_message_to_words(), but takes aReaderSegments, allowing it to be used onmessage::Readerobjects (viainto_segments()). - write_
message_ to_ words - Constructs a flat vector containing the entire message, including a segment header.
Type Aliases§
- NoAlloc
Slice Segments - Alias for the common case where the buffer in
NoAllocBufferSegmentsis a u8 slice.