Skip to main content

ResponseExt

Trait ResponseExt 

Source
pub trait ResponseExt<B>: Sized {
    // Required methods
    fn json<T: DeserializeOwned>(
        self,
    ) -> impl Future<Output = Result<Response<T>, ResponseError>> + Send;
    fn text(
        self,
    ) -> impl Future<Output = Result<Response<String>, ResponseError>> + Send;
    fn bytes(
        self,
    ) -> impl Future<Output = Result<Response<Bytes>, ResponseError>> + Send;
    fn data_stream(self) -> Response<BodyDataStream<B>>;
    fn buffer(
        self,
    ) -> impl Future<Output = Result<Response<impl Buf>, ResponseError>> + Send;
    fn hyper_upgrade(
        self,
    ) -> impl Future<Output = Result<Upgraded, ResponseError>> + Send;
}
Expand description

Extension trait for http::Response.

Required Methods§

Source

fn json<T: DeserializeOwned>( self, ) -> impl Future<Output = Result<Response<T>, ResponseError>> + Send

Available on crate feature json only.
Source

fn text( self, ) -> impl Future<Output = Result<Response<String>, ResponseError>> + Send

Source

fn bytes( self, ) -> impl Future<Output = Result<Response<Bytes>, ResponseError>> + Send

Source

fn data_stream(self) -> Response<BodyDataStream<B>>

Source

fn buffer( self, ) -> impl Future<Output = Result<Response<impl Buf>, ResponseError>> + Send

Source

fn hyper_upgrade( self, ) -> impl Future<Output = Result<Upgraded, ResponseError>> + Send

Available on crate feature hyper only.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<B> ResponseExt<B> for Response<B>
where B: Body + Send, B::Data: Send, B::Error: Error + Send + 'static,