Trait FromRequest

Source
pub trait FromRequest<B, M = ViaRequest>: Sized {
    type Rejection: IntoResponse;

    // Required method
    fn from_request(
        req: Request<B>,
    ) -> impl Future<Output = Result<Self, Self::Rejection>> + Send;
}

Required Associated Types§

Source

type Rejection: IntoResponse

If the extractor fails it’ll use this “rejection” type. A rejection is a kind of error that can be converted into a response.

Required Methods§

Source

fn from_request( req: Request<B>, ) -> impl Future<Output = Result<Self, Self::Rejection>> + Send

Perform the extraction.

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, T> FromRequest<B> for Result<T, <T as FromRequest<B>>::Rejection>
where B: Send, T: FromRequest<B>,

Implementors§

Source§

impl<B> FromRequest<B> for Request<B>
where B: Send,

Source§

impl<B, T> FromRequest<B, ViaParts> for T
where B: Send, T: FromRequestParts,