Trait BodyExtractExt

Source
pub trait BodyExtractExt: Sealed {
    // Required methods
    fn try_into_json<T: DeserializeOwned + Send + 'static>(
        self,
    ) -> impl Future<Output = Result<T, OpaqueError>> + Send;
    fn try_into_string(
        self,
    ) -> impl Future<Output = Result<String, OpaqueError>> + Send;
}
Expand description

An extension trait for Body that provides methods to extract data from it.

Required Methods§

Source

fn try_into_json<T: DeserializeOwned + Send + 'static>( self, ) -> impl Future<Output = Result<T, OpaqueError>> + Send

Try to deserialize the (contained) body as a JSON object.

Source

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

Try to turn the (contained) body in an utf-8 string.

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§

Source§

impl<B: Into<Body> + Send + 'static> BodyExtractExt for B

Source§

impl<Body> BodyExtractExt for Request<Body>
where Body: Body<Data: Send + 'static, Error: Into<BoxError>> + Send + 'static,

Source§

impl<Body> BodyExtractExt for Response<Body>
where Body: Body<Data: Send + 'static, Error: Into<BoxError>> + Send + 'static,