Trait FromRequest

Source
pub trait FromRequest<B = Body>: Sized {
    type Error: Into<BoxedErrorResponse>;

    // Required method
    fn from_request(
        head_parts: &mut RequestHeadParts,
        body: B,
    ) -> impl Future<Output = Result<Self, Self::Error>> + Send;
}
Expand description

A trait for extractor types.

Implementors of the FromRequest consume the request body and usually convert it to some form of data.

Required Associated Types§

Required Methods§

Source

fn from_request( head_parts: &mut RequestHeadParts, body: B, ) -> impl Future<Output = Result<Self, Self::Error>> + Send

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.

Implementations on Foreign Types§

Source§

impl<B> FromRequest<B> for ()

Source§

type Error = Infallible

Source§

fn from_request( _head_parts: &mut RequestHeadParts, _: B, ) -> impl Future<Output = Result<Self, Self::Error>> + Send

Source§

impl<B, T> FromRequest<B> for Option<T>
where T: FromRequest<B>,

Source§

type Error = Infallible

Source§

fn from_request( head_parts: &mut RequestHeadParts, body: B, ) -> impl Future<Output = Result<Self, Self::Error>>

Source§

impl<B, T, E> FromRequest<B> for Result<T, E>
where T: FromRequest<B, Error = E>,

Source§

type Error = Infallible

Source§

fn from_request( head_parts: &mut RequestHeadParts, body: B, ) -> impl Future<Output = Result<Self, Self::Error>>

Implementors§