Skip to main content

FromRequestBody

Trait FromRequestBody 

pub trait FromRequestBody: FromRequest {
    // Required method
    fn from_request_body(
        parts: &Parts,
        body: Body,
    ) -> impl Future<Output = Result<Self, Self::Rejection>> + Send + 'static;
}
Available on crate features http and std only.
Expand description

Types that own the request body while only borrowing the other request parts.

This is the body-only counterpart to FromRequest. It enables an immediately preceding FromOwnedRequestParts extractor to take ownership of the request parts after the body extractor has finished inspecting them. Types implementing this trait also implement FromRequest so they remain usable as ordinary terminal extractors.

Required Methods§

fn from_request_body( parts: &Parts, body: Body, ) -> impl Future<Output = Result<Self, Self::Rejection>> + Send + 'static

Prepare extraction using borrowed request parts and an owned request body.

The returned future cannot borrow parts, allowing the request parts to be dropped or moved before body processing is awaited.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

§

impl FromRequestBody for Body

§

impl FromRequestBody for Bytes

§

impl FromRequestBody for Multipart

§

impl FromRequestBody for OctetStream

§

impl FromRequestBody for Text

§

impl<T> FromRequestBody for Csv<Vec<T>>
where T: DeserializeOwned + Send + Sync + 'static,

§

impl<T> FromRequestBody for Form<T>
where T: DeserializeOwned + Send + Sync + 'static,

§

impl<T> FromRequestBody for Json<T>
where T: DeserializeOwned + Send + Sync + 'static,

§

impl<T> FromRequestBody for JsonReadStream<T, BodyDataStream>
where T: DeserializeOwned + Send + Sync + 'static,

§

impl<T> FromRequestBody for Option<T>

§

impl<T> FromRequestBody for ReadSignals<T>
where T: DeserializeOwned + Send + Sync + 'static,