Expand description
Streaming framing / deframing — process a byte STREAM of length-delimited messages
INCREMENTALLY, as bytes arrive, without ever buffering the whole stream. This is the basis of
every streaming protocol (gRPC, Arrow Flight, Kafka): a producer frames each message as
[uvarint length][body]; a consumer feeds arriving chunks — ANY chunking, from byte-at-a-time
to many frames at once to a frame split across chunks — to a StreamDeframer, which hands
back each complete frame the instant it is buffered, ZERO-COPY (the body is a borrowed slice, so
pair it with crate::concurrency::marshal::view_message for a fully in-place stream read).
Paired with the zero-copy WireView receive, this closes Cap’n Proto’s streaming claim:
incremental reads with no whole-stream buffering and no decode of untouched fields.
Structs§
- Stream
Deframer - An incremental deframer. Feed it arriving bytes with
push; pull complete frames withdrain_frames. Holds only the bytes not yet delivered (a partial frame at most), so memory stays bounded regardless of stream length.
Functions§
- frame_
for_ stream - Frame
bodyfor the stream: a LEB128 length prefix, then the bytes. Append-only intoout, so a producer can concatenate many frames into one stream buffer.