Expand description
Output abstraction for message encoding.
EncodeSink is the byte sink every encode path writes into. Its four
required methods are the BufMut primitives the encoders bottom out
in (the fixed-width signed/float writers are provided on top), plus
put_shared for splicing an owned Bytes
segment into the output without copying it.
Every BufMut implementor is an EncodeSink through a blanket impl,
with put_shared copying — the contiguous behavior every existing caller
already has. Rope implements the trait directly (it is deliberately
not a BufMut) and captures large segments by reference count instead,
so encoding a message whose dominant content is one large bytes field
costs O(everything-but-the-payload) rather than O(payload).
Structs§
- Rope
- A segmented encode sink: an ordered sequence of
Bytessegments. - RopeBuf
- A
Bufover a finished rope’s segments, for consumers (hyper, h2, vectored writers) that take anyBufand iterate its chunks.
Constants§
- DEFAULT_
MIN_ SEGMENT - Default minimum segment size for
Rope: payloads below this are copied into the small-write tail buffer rather than kept as their own segment.
Traits§
- Encode
Sink - Byte sink for message encoding.