pub type StreamProducer = Box<dyn FnOnce(&mut dyn Write) -> Result<()> + Send + 'static>;Expand description
A response body: either fully buffered, or streamed incrementally.
Streaming leans on the connection-per-request, Connection: close model:
we omit Content-Length, write the headers, then hand the raw socket to a
producer closure that flushes bytes over time. The client reads until the
connection closes (a valid HTTP/1.1 framing). No chunked encoding, no async.
Producer closure for a streaming Body: hands the raw socket to the
caller, which flushes bytes over time until it returns (and the connection
closes).
Aliased Typeยง
pub struct StreamProducer(/* private fields */);