Trait AnyAsyncResponse

Source
pub trait AnyAsyncResponse:
    Any
    + Send
    + Sync
    + 'static {
    // Required methods
    fn describe(&self, f: &mut Formatter<'_>) -> Result;
    fn status(&self) -> u16;
    fn content_length(&self) -> Option<u64>;
    fn get_header(&self, header: &str) -> Result<Vec<String>>;
    fn text(&mut self) -> BoxFuture<'_, Result<String>>;
    fn bytes(&mut self) -> BoxFuture<'_, Result<Vec<u8>>>;
}
Available on crate feature async only.
Expand description

Trait for type-erased async HTTP responses.

Automatically implemented for types implementing AsyncResponse.

Required Methods§

Source

fn describe(&self, f: &mut Formatter<'_>) -> Result

Provides a textual description of this response.

Source

fn status(&self) -> u16

Returns the HTTP status code of this response.

Source

fn content_length(&self) -> Option<u64>

Returns the content-length of the response body, if known.

Source

fn get_header(&self, header: &str) -> Result<Vec<String>>

Gets all values for the specified header.

Source

fn text(&mut self) -> BoxFuture<'_, Result<String>>

Reads the response body as text.

Source

fn bytes(&mut self) -> BoxFuture<'_, Result<Vec<u8>>>

Reads the response body as bytes.

Implementors§