rama::http

Trait BodyExtractExt

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§

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.

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

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

Object Safety§

This trait is not object safe.

Implementors§

§

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

§

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 + Sync + Send>>,

§

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 + Sync + Send>>,