rama_http

Trait BodyExtractExt

Source
pub trait BodyExtractExt: Sealed {
    // Required methods
    fn try_into_json<T>(
        self,
    ) -> impl Future<Output = Result<T, OpaqueError>> + Send
       where T: DeserializeOwned + Send + 'static;
    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>(self) -> impl Future<Output = Result<T, OpaqueError>> + Send
where T: DeserializeOwned + Send + 'static,

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> BodyExtractExt for B
where B: Into<Body> + Send + 'static,

Source§

impl<Body> BodyExtractExt for Request<Body>
where Body: Body + Send + 'static, <Body as Body>::Data: Send + 'static, <Body as Body>::Error: Into<Box<dyn Error + Send + Sync>>,

Source§

impl<Body> BodyExtractExt for Response<Body>
where Body: Body + Send + 'static, <Body as Body>::Data: Send + 'static, <Body as Body>::Error: Into<Box<dyn Error + Send + Sync>>,