Skip to main content

ResponseWriter

Trait ResponseWriter 

Source
pub trait ResponseWriter {
    // Required methods
    fn write_head(
        &mut self,
        head: ResponseHead,
        scope: &RequestScope,
    ) -> Result<()>;
    fn write_chunk(&mut self, chunk: &[u8], scope: &RequestScope) -> Result<()>;
    fn finish(
        &mut self,
        trailers: &[Header],
        scope: &RequestScope,
    ) -> Result<()>;
}
Expand description

Push-based response body with write completion as its backpressure acknowledgement.

Required Methods§

Source

fn write_head(&mut self, head: ResponseHead, scope: &RequestScope) -> Result<()>

Emits the response head exactly once.

Source

fn write_chunk(&mut self, chunk: &[u8], scope: &RequestScope) -> Result<()>

Emits one bounded chunk and returns only when the connection accepts it.

Source

fn finish(&mut self, trailers: &[Header], scope: &RequestScope) -> Result<()>

Completes the body, subject to the server trailer policy.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§