Expand description
Length-prefixed frame codec for reading and writing protocol messages.
Wire format: [len: u32 BE][id: u32 BE][flags: u8][body].
Control bodies are CBOR; generation-8 bulk bodies use a fixed raw header.
The correlation ID and flags sit in a fixed-position binary header so that relay intermediaries can route frames without CBOR parsing.
Structs§
- RawFrame
- A frame with the binary header parsed but the body left untouched.
Enums§
- Decoded
Frame - One fully validated control message or raw bulk record.
Constants§
- MAX_
FRAME_ SIZE - Maximum allowed frame size (4 MiB).
- MAX_
WIRE_ FRAME - Maximum complete encoded frame size, including the four-byte length prefix.
Functions§
- decode_
message_ frame - Decodes one complete length-prefixed frame from a borrowed byte slice.
- encode_
bulk_ header - Encodes the fixed outer and generation-8 bulk headers, leaving the payload separate.
- encode_
bulk_ to_ buf - Encodes a generation-8 raw bulk record into a contiguous byte buffer.
- encode_
raw_ to_ buf - Encodes a raw frame to a byte buffer using the length-prefixed format.
- encode_
to_ buf - Encodes a message to a byte buffer using the length-prefixed frame format.
- raw_
frame_ to_ bulk - Decodes and validates a raw frame as a generation-8 bulk record.
- raw_
frame_ to_ message - Decodes a
RawFrameinto a typedMessageby CBOR-deserializing the body. - read_
message - Reads a length-prefixed message from the given reader.
- read_
raw_ frame - Reads a length-prefixed raw frame from the given reader.
- try_
decode_ frame_ from_ bytes - Decodes one complete control or generation-8 bulk frame from a cursor-based buffer.
- try_
decode_ from_ buf - Tries to decode a complete message from a byte buffer.
- try_
decode_ from_ bytes - Decode one complete typed frame from a cursor-based buffer without front-draining it.
- try_
decode_ raw_ from_ buf - Tries to decode a complete raw frame from a byte buffer.
- write_
bulk_ record - Writes a generation-8 raw bulk record without copying its payload.
- write_
message - Writes a length-prefixed message to the given writer.
- write_
raw_ frame - Writes a length-prefixed raw frame to the given writer.