Expand description
Wire frame codec. Mirrors the Go reference in go/frame/frame.go.
Layout: 24-byte big-endian header (magic, version, flags, method, request id, meta length, payload length), then Protobuf meta, then raw payload bytes.
Structs§
- Frame
- One decoded message. Build it with
Frame::new. New fields can be added in a minor version.
Constants§
- FLAG_
ERROR - FLAG_
NOTIFY - Server-initiated frame (a notice). The request id is the id of the call it answers.
- FLAG_
RESPONSE - FLAG_
STREAM_ END - HEADER_
SIZE - MAGIC
- MAX_
META_ BYTES - MAX_
PAYLOAD_ BYTES - VERSION
Functions§
- check_
limits - Rejects sections over the limits. Callers run this before they send a byte, so an oversize request fails alone and leaves the connection usable.
- read
- Reads one frame. Returns
Ok(None)only when the stream ends cleanly at a frame boundary. A mid-frame end is anUnexpectedEofI/O error. - write
- Writes one frame. Rejects sections over the limits before sending anything.
- write_
parts - Writes one frame from borrowed sections with a single vectored write, so the payload is not copied and the header, meta and payload leave in one call.