Module capnp::serialize

source ·
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§

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 in buffer. Returns a BufferNotLargeEnough error if the buffer is not large enough. ALIGNMENT: If the “unaligned” feature is enabled, then there are no alignment requirements on buffer. 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 in read. 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 in buffer. Returns a BufferNotLargeEnough error if the buffer is not large enough. ALIGNMENT: If the “unaligned” feature is enabled, then there are no alignment requirements on buffer. 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 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.

Type Aliases§

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