Skip to main content

Module buffer

Module buffer 

Source
Expand description

Coalescing small encoded chunks into larger ones.

Without this, a format whose items are small (JSON Lines of short objects, say) emits one HTTP frame per item, which is dreadful wire efficiency. It matters on the sending side in both directions: a client uploading a stream has exactly the same problem as a server returning one.

Core yields Bytes; wrapping them in whatever frame type the HTTP layer wants is the binding crate’s job.

Functions§

buffer_bytes
Coalesce output into chunks of at least size bytes.
buffer_ready_items
Coalesce every count items that are ready at the same time into one chunk.