pub struct ResponseWriter<W> { /* private fields */ }Expand description
The response lane. A partially sent or abandoned response permanently
poisons admission. The owner must still await close to retire the backend.
Implementations§
Source§impl<W: WritableStream> ResponseWriter<W>
impl<W: WritableStream> ResponseWriter<W>
pub fn new(writer: W) -> Self
Sourcepub fn is_usable(&self) -> bool
pub fn is_usable(&self) -> bool
Whether another message can be written. A failed write which leaves output usable wrote none of its message, so the owner can still send a different response.
pub fn interim(&mut self, version: Version) -> InterimWriter<'_, W>
Sourcepub async fn reject(
&mut self,
status: Status,
cancellation: &Cancellation,
) -> Result<(), Error>
pub async fn reject( &mut self, status: Status, cancellation: &Cancellation, ) -> Result<(), Error>
Best-effort rejection for invalid input, followed by connection closure.
Sourcepub async fn write_response<B: ReadableBody>(
&mut self,
exchange: &Exchange,
response: &mut Response<B>,
cancellation: &Cancellation,
) -> Result<bool, Error>
pub async fn write_response<B: ReadableBody>( &mut self, exchange: &Exchange, response: &mut Response<B>, cancellation: &Cancellation, ) -> Result<bool, Error>
Write one final response. true means output permits persistence; the
connection owner must also finish input and join concurrent work before
admitting another request. Discarded input disables persistence.
A response refused before any of it is written, such as one with an informational status, conflicting framing or a Content-Length field its body contradicts, leaves output usable.
A response to an HTTP/1.0 request has no chunked framing, so any trailers its body produces are dropped.