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§
fn json<T: DeserializeOwned>( self, ) -> impl Future<Output = Result<Response<T>, ResponseError>> + Send
Available on crate feature
json
only.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
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", so this trait is not object safe.