pub struct Payload { /* private fields */ }Expand description
A buffered stream of an HTTP/1 request body’s decoded bytes.
Each item is either a body chunk or a PayloadError.
Normal body completion closes the stream, after which receiving returns
None. A payload error is yielded once before the stream terminates.
The HTTP/1 dispatcher stops reading body data while this stream’s buffer is full. Consuming items therefore releases transport-level backpressure. Dropping the stream before the complete body has been decoded prevents the connection from being reused and causes the dispatcher to disconnect it.
Dereferences to the underlying bstream::Receiver.
Implementations§
Methods from Deref<Target = Receiver<PayloadError>>§
Sourcepub fn set_watermarks(&self, high: u32, low: u32)
pub fn set_watermarks(&self, high: u32, low: u32)
Sets the sender backpressure watermarks.
Once buffered data reaches high bytes, Sender::poll_ready stops
reporting Status::Ready until the receiver drains the buffer to
low bytes or less, so the sender is not woken for every consumed
chunk. low is capped below high.
Sending does not enforce the watermarks, so producers must cooperate
by waiting for readiness. Changing the watermarks immediately updates
and, when needed, wakes sender readiness: the sender is ready if
buffered data is below high. The defaults are 32 KiB and 16 KiB.
Sourcepub fn max_buffer_size(&self, size: usize)
👎Deprecated since 4.2.0: Use Receiver::set_watermarks() instead
pub fn max_buffer_size(&self, size: usize)
Use Receiver::set_watermarks() instead
Sets the sender backpressure threshold.
Sets the high watermark to size and the low watermark to half of it.
Sourcepub fn put(&self, data: Bytes)
pub fn put(&self, data: Bytes)
Puts previously read data back at the front of the stream.
This may grow the buffer past its readiness threshold.
Sourcepub fn is_eof(&self) -> bool
pub fn is_eof(&self) -> bool
Returns true once EOF has been marked.
Buffered chunks may still be available after this returns true.