Trait ClientRes

pub trait ClientRes<E> {
    // Required methods
    fn try_into_string(self) -> impl Future<Output = Result<String, E>> + Send;
    fn try_into_bytes(self) -> impl Future<Output = Result<Bytes, E>> + Send;
    fn try_into_stream(
        self,
    ) -> Result<impl Stream<Item = Result<Bytes, Bytes>> + Send + Sync + 'static, E>;
    fn status(&self) -> u16;
    fn status_text(&self) -> String;
    fn location(&self) -> String;
    fn has_redirect(&self) -> bool;
}
Expand description

Represents the response as received by the client.

Required Methods§

fn try_into_string(self) -> impl Future<Output = Result<String, E>> + Send

Attempts to extract a UTF-8 string from an HTTP response.

fn try_into_bytes(self) -> impl Future<Output = Result<Bytes, E>> + Send

Attempts to extract a binary blob from an HTTP response.

fn try_into_stream( self, ) -> Result<impl Stream<Item = Result<Bytes, Bytes>> + Send + Sync + 'static, E>

Attempts to extract a binary stream from an HTTP response.

fn status(&self) -> u16

HTTP status code of the response.

fn status_text(&self) -> String

Status text for the status code.

fn location(&self) -> String

The Location header or (if none is set), the URL of the response.

fn has_redirect(&self) -> bool

Whether the response has the REDIRECT_HEADER set.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§