Skip to main content

HttpResponse

Trait HttpResponse 

Source
pub trait HttpResponse:
    Send
    + Sync
    + Debug
    + Unpin {
    type Headers: HttpHeaders;
    type ChunkError: Error + Send + Sync + Unpin;

    // Required methods
    fn headers(&self) -> &Self::Headers;
    fn url(&self) -> &Url;
    fn chunk(
        &mut self,
    ) -> impl Future<Output = Result<Option<Bytes>, Self::ChunkError>> + Send;
}
Expand description

Abstraction over an HTTP response that provides headers, final URL, and chunked body reading.

Required Associated Types§

Source

type Headers: HttpHeaders

The response’s header map type.

Source

type ChunkError: Error + Send + Sync + Unpin

The error type produced while reading a body chunk.

Required Methods§

Source

fn headers(&self) -> &Self::Headers

The response headers.

Source

fn url(&self) -> &Url

The URL the response was served from, after redirects.

Source

fn chunk( &mut self, ) -> impl Future<Output = Result<Option<Bytes>, Self::ChunkError>> + Send

Read the next body chunk, or None at end of body.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl HttpResponse for Response

Source§

type Headers = HeaderMap

Source§

type ChunkError = Error

Source§

fn headers(&self) -> &Self::Headers

Source§

fn url(&self) -> &Url

Source§

async fn chunk(&mut self) -> Result<Option<Bytes>, Self::ChunkError>

Implementors§