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 of
read_message
.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 a SliceSegments
.Segments read from a single flat slice of words.
Enums
Segments read from a buffer, useful for when you have the message in a buffer and don’t want the
extra copy of
read_message
.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 returns None instead of an error if there are zero bytes left in
read
. This is useful for reading a stream containing an unknown number of messages – you
call this function until it returns None.Writes the provided message to
write
.Like
write_message()
, but takes a ReaderSegments
, allowing it to be
used on message::Reader
objects (via into_segments()
).Like
write_message_to_words()
, but takes a ReaderSegments
, allowing it to be
used on message::Reader
objects (via into_segments()
).Constructs a flat vector containing the entire message, including a segment header.