[][src]Crate chunked_bytes

A non-contiguous buffer for efficient serialization of data structures and vectored output.

This crate provides ChunkedBytes, a rope-like byte container based on Bytes and BytesMut from the bytes crate. Its primary purpose is to serve as an intermediate buffer for serializing fields of data structures into byte sequences of varying length, without whole-buffer reallocations like those performed to grow a Vec, and then consuming the bytes in bulk, split into regularly sized chunks suitable for vectored output.

ChunkedBytes implements the traits Buf and BufMut for read and write access to the buffered data. It also provides the push_chunk method for appending a Bytes slice to its queue of non-contiguous chunks without copying the data.

Structs

ChunkedBytes

A non-contiguous buffer for efficient serialization of data structures.

DrainChunks

The iterator produced by the drain_chunks method of ChunkedBytes.

IntoChunks

The iterator produced by the into_chunks method of ChunkedBytes.