pub struct ResponseStream { /* private fields */ }Expand description
A streamed response body: chunks plus optional trailers. The
explicit streaming contract that replaced Body::Stream. Ride it on
Response.stream; the buffered case leaves that field None.
Implementations§
Source§impl ResponseStream
impl ResponseStream
Sourcepub fn from_chunk_stream(stream: ChunkStream) -> Self
pub fn from_chunk_stream(stream: ChunkStream) -> Self
Build from an already-boxed ChunkStream.
Sourcepub fn once(bytes: Bytes) -> Self
pub fn once(bytes: Bytes) -> Self
One-chunk stream wrapping a complete Bytes — the buffered ->
streaming bridge.
Sourcepub fn with_trailers_slot(self, slot: TrailersSlot) -> Self
pub fn with_trailers_slot(self, slot: TrailersSlot) -> Self
Attach a trailers slot a chunked producer will populate at end.
Sourcepub fn with_trailers(self, trailers: HeaderList) -> Self
pub fn with_trailers(self, trailers: HeaderList) -> Self
Attach trailers known up front.
Sourcepub fn trailers(&self) -> Option<HeaderList>
pub fn trailers(&self) -> Option<HeaderList>
Read captured trailers, if any. None until a stream-end
producer has populated the slot.
Sourcepub fn trailers_slot(&self) -> Option<&TrailersSlot>
pub fn trailers_slot(&self) -> Option<&TrailersSlot>
Borrow the trailers slot — handed to a producer (e.g. the H1 chunked-decoder pump) before the stream completes.
Sourcepub fn into_chunk_stream(self) -> ChunkStream
pub fn into_chunk_stream(self) -> ChunkStream
Take the underlying chunk stream (drops trailers metadata).
Sourcepub fn chunk_stream_mut(&mut self) -> &mut ChunkStream
pub fn chunk_stream_mut(&mut self) -> &mut ChunkStream
Borrow the chunk stream mutably (listener pump path).
Sourcepub async fn drain(self) -> Result<(), ProximaError>
pub async fn drain(self) -> Result<(), ProximaError>
Consume the body stream without materializing any Bytes — read and
discard all chunks until the stream ends. The framing decoder still
runs (the caller must exhaust the body to reach the keep-alive
message boundary); only the per-chunk allocation and copy are skipped.