FromRequest

Trait FromRequest 

Source
pub trait FromRequest: Send {
    type Output<'r>: Send;
    type Error: Responder + Send;

    // Required method
    fn from_request<'r>(
        req: &'r RequestContext<'_, '_>,
        body: OptionReqBody,
    ) -> impl Future<Output = Result<Self::Output<'r>, Self::Error>> + Send;
}

Required Associated Types§

Required Methods§

Source

fn from_request<'r>( req: &'r RequestContext<'_, '_>, body: OptionReqBody, ) -> impl Future<Output = Result<Self::Output<'r>, 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 FromRequest for &HeaderMap

Extracts a reference to the header map

This extractor provides borrowed access to all HTTP headers.

Source§

type Output<'r> = &'r HeaderMap

Source§

type Error = ParseError

Source§

async fn from_request<'r>( req: &'r RequestContext<'_, '_>, _body: OptionReqBody, ) -> Result<Self::Output<'r>, Self::Error>

Source§

impl FromRequest for &Method

Extracts a reference to the HTTP method

This extractor borrows the request method, avoiding cloning.

Source§

type Output<'r> = &'r Method

Source§

type Error = ParseError

Source§

async fn from_request<'r>( req: &'r RequestContext<'_, '_>, _body: OptionReqBody, ) -> Result<Self::Output<'r>, Self::Error>

Source§

impl FromRequest for &RequestHeader

Extracts a reference to the raw request header

Provides access to the underlying HTTP request header structure.

Source§

type Output<'r> = &'r RequestHeader

Source§

type Error = ParseError

Source§

async fn from_request<'r>( req: &'r RequestContext<'_, '_>, _body: OptionReqBody, ) -> Result<Self::Output<'r>, Self::Error>

Source§

impl FromRequest for ()

Source§

type Output<'r> = ()

Source§

type Error = Infallible

Source§

async fn from_request<'r>( _req: &'r RequestContext<'_, '_>, _body: OptionReqBody, ) -> Result<Self::Output<'r>, Self::Error>

Source§

impl FromRequest for String

Extracts UTF-8 string from request body

Source§

type Output<'any> = String

Source§

type Error = ParseError

Source§

async fn from_request( req: &RequestContext<'_, '_>, body: OptionReqBody, ) -> Result<Self::Output<'static>, Self::Error>

Source§

impl FromRequest for Bytes

Extracts raw bytes from request body

Source§

type Output<'any> = Bytes

Source§

type Error = ParseError

Source§

async fn from_request( _req: &RequestContext<'_, '_>, body: OptionReqBody, ) -> Result<Self::Output<'static>, Self::Error>

Source§

impl FromRequest for HeaderMap

Extracts the header map by value

This extractor clones and takes ownership of all HTTP headers.

Source§

type Output<'any> = HeaderMap

Source§

type Error = ParseError

Source§

async fn from_request( req: &RequestContext<'_, '_>, _body: OptionReqBody, ) -> Result<Self::Output<'static>, Self::Error>

Source§

impl FromRequest for Method

Extracts the HTTP method by value

This extractor takes ownership of the request method.

Source§

type Output<'any> = Method

Source§

type Error = ParseError

Source§

async fn from_request( req: &RequestContext<'_, '_>, _body: OptionReqBody, ) -> Result<Self::Output<'static>, Self::Error>

Source§

impl<A> FromRequest for (A,)
where A: FromRequest, for<'any> A::Output<'any>: Send,

Source§

type Output<'r> = (<A as FromRequest>::Output<'r>,)

Source§

type Error = EitherA<<A as FromRequest>::Error>

Source§

async fn from_request<'r>( req: &'r RequestContext<'_, '_>, body: OptionReqBody, ) -> Result<Self::Output<'r>, Self::Error>

Source§

impl<A, B> FromRequest for (A, B)
where A: FromRequest, B: FromRequest, for<'any> A::Output<'any>: Send, for<'any> B::Output<'any>: Send,

Source§

type Output<'r> = (<A as FromRequest>::Output<'r>, <B as FromRequest>::Output<'r>)

Source§

type Error = EitherAB<<A as FromRequest>::Error, <B as FromRequest>::Error>

Source§

async fn from_request<'r>( req: &'r RequestContext<'_, '_>, body: OptionReqBody, ) -> Result<Self::Output<'r>, Self::Error>

Source§

impl<A, B, C> FromRequest for (A, B, C)
where A: FromRequest, B: FromRequest, C: FromRequest, for<'any> A::Output<'any>: Send, for<'any> B::Output<'any>: Send, for<'any> C::Output<'any>: Send,

Source§

type Output<'r> = (<A as FromRequest>::Output<'r>, <B as FromRequest>::Output<'r>, <C as FromRequest>::Output<'r>)

Source§

type Error = EitherABC<<A as FromRequest>::Error, <B as FromRequest>::Error, <C as FromRequest>::Error>

Source§

async fn from_request<'r>( req: &'r RequestContext<'_, '_>, body: OptionReqBody, ) -> Result<Self::Output<'r>, Self::Error>

Source§

impl<A, B, C, D> FromRequest for (A, B, C, D)
where A: FromRequest, B: FromRequest, C: FromRequest, D: FromRequest, for<'any> A::Output<'any>: Send, for<'any> B::Output<'any>: Send, for<'any> C::Output<'any>: Send, for<'any> D::Output<'any>: Send,

Source§

type Output<'r> = (<A as FromRequest>::Output<'r>, <B as FromRequest>::Output<'r>, <C as FromRequest>::Output<'r>, <D as FromRequest>::Output<'r>)

Source§

type Error = EitherABCD<<A as FromRequest>::Error, <B as FromRequest>::Error, <C as FromRequest>::Error, <D as FromRequest>::Error>

Source§

async fn from_request<'r>( req: &'r RequestContext<'_, '_>, body: OptionReqBody, ) -> Result<Self::Output<'r>, Self::Error>

Source§

impl<A, B, C, D, E> FromRequest for (A, B, C, D, E)
where A: FromRequest, B: FromRequest, C: FromRequest, D: FromRequest, E: FromRequest, for<'any> A::Output<'any>: Send, for<'any> B::Output<'any>: Send, for<'any> C::Output<'any>: Send, for<'any> D::Output<'any>: Send, for<'any> E::Output<'any>: Send,

Source§

type Output<'r> = (<A as FromRequest>::Output<'r>, <B as FromRequest>::Output<'r>, <C as FromRequest>::Output<'r>, <D as FromRequest>::Output<'r>, <E as FromRequest>::Output<'r>)

Source§

type Error = EitherABCDE<<A as FromRequest>::Error, <B as FromRequest>::Error, <C as FromRequest>::Error, <D as FromRequest>::Error, <E as FromRequest>::Error>

Source§

async fn from_request<'r>( req: &'r RequestContext<'_, '_>, body: OptionReqBody, ) -> Result<Self::Output<'r>, Self::Error>

Source§

impl<A, B, C, D, E, F> FromRequest for (A, B, C, D, E, F)
where A: FromRequest, B: FromRequest, C: FromRequest, D: FromRequest, E: FromRequest, F: FromRequest, for<'any> A::Output<'any>: Send, for<'any> B::Output<'any>: Send, for<'any> C::Output<'any>: Send, for<'any> D::Output<'any>: Send, for<'any> E::Output<'any>: Send, for<'any> F::Output<'any>: Send,

Source§

type Output<'r> = (<A as FromRequest>::Output<'r>, <B as FromRequest>::Output<'r>, <C as FromRequest>::Output<'r>, <D as FromRequest>::Output<'r>, <E as FromRequest>::Output<'r>, <F as FromRequest>::Output<'r>)

Source§

type Error = EitherABCDEF<<A as FromRequest>::Error, <B as FromRequest>::Error, <C as FromRequest>::Error, <D as FromRequest>::Error, <E as FromRequest>::Error, <F as FromRequest>::Error>

Source§

async fn from_request<'r>( req: &'r RequestContext<'_, '_>, body: OptionReqBody, ) -> Result<Self::Output<'r>, Self::Error>

Source§

impl<A, B, C, D, E, F, G> FromRequest for (A, B, C, D, E, F, G)
where A: FromRequest, B: FromRequest, C: FromRequest, D: FromRequest, E: FromRequest, F: FromRequest, G: FromRequest, for<'any> A::Output<'any>: Send, for<'any> B::Output<'any>: Send, for<'any> C::Output<'any>: Send, for<'any> D::Output<'any>: Send, for<'any> E::Output<'any>: Send, for<'any> F::Output<'any>: Send, for<'any> G::Output<'any>: Send,

Source§

type Output<'r> = (<A as FromRequest>::Output<'r>, <B as FromRequest>::Output<'r>, <C as FromRequest>::Output<'r>, <D as FromRequest>::Output<'r>, <E as FromRequest>::Output<'r>, <F as FromRequest>::Output<'r>, <G as FromRequest>::Output<'r>)

Source§

type Error = EitherABCDEFG<<A as FromRequest>::Error, <B as FromRequest>::Error, <C as FromRequest>::Error, <D as FromRequest>::Error, <E as FromRequest>::Error, <F as FromRequest>::Error, <G as FromRequest>::Error>

Source§

async fn from_request<'r>( req: &'r RequestContext<'_, '_>, body: OptionReqBody, ) -> Result<Self::Output<'r>, Self::Error>

Source§

impl<A, B, C, D, E, F, G, H> FromRequest for (A, B, C, D, E, F, G, H)
where A: FromRequest, B: FromRequest, C: FromRequest, D: FromRequest, E: FromRequest, F: FromRequest, G: FromRequest, H: FromRequest, for<'any> A::Output<'any>: Send, for<'any> B::Output<'any>: Send, for<'any> C::Output<'any>: Send, for<'any> D::Output<'any>: Send, for<'any> E::Output<'any>: Send, for<'any> F::Output<'any>: Send, for<'any> G::Output<'any>: Send, for<'any> H::Output<'any>: Send,

Source§

type Output<'r> = (<A as FromRequest>::Output<'r>, <B as FromRequest>::Output<'r>, <C as FromRequest>::Output<'r>, <D as FromRequest>::Output<'r>, <E as FromRequest>::Output<'r>, <F as FromRequest>::Output<'r>, <G as FromRequest>::Output<'r>, <H as FromRequest>::Output<'r>)

Source§

type Error = EitherABCDEFGH<<A as FromRequest>::Error, <B as FromRequest>::Error, <C as FromRequest>::Error, <D as FromRequest>::Error, <E as FromRequest>::Error, <F as FromRequest>::Error, <G as FromRequest>::Error, <H as FromRequest>::Error>

Source§

async fn from_request<'r>( req: &'r RequestContext<'_, '_>, body: OptionReqBody, ) -> Result<Self::Output<'r>, Self::Error>

Source§

impl<A, B, C, D, E, F, G, H, I> FromRequest for (A, B, C, D, E, F, G, H, I)
where A: FromRequest, B: FromRequest, C: FromRequest, D: FromRequest, E: FromRequest, F: FromRequest, G: FromRequest, H: FromRequest, I: FromRequest, for<'any> A::Output<'any>: Send, for<'any> B::Output<'any>: Send, for<'any> C::Output<'any>: Send, for<'any> D::Output<'any>: Send, for<'any> E::Output<'any>: Send, for<'any> F::Output<'any>: Send, for<'any> G::Output<'any>: Send, for<'any> H::Output<'any>: Send, for<'any> I::Output<'any>: Send,

Source§

type Output<'r> = (<A as FromRequest>::Output<'r>, <B as FromRequest>::Output<'r>, <C as FromRequest>::Output<'r>, <D as FromRequest>::Output<'r>, <E as FromRequest>::Output<'r>, <F as FromRequest>::Output<'r>, <G as FromRequest>::Output<'r>, <H as FromRequest>::Output<'r>, <I as FromRequest>::Output<'r>)

Source§

type Error = EitherABCDEFGHI<<A as FromRequest>::Error, <B as FromRequest>::Error, <C as FromRequest>::Error, <D as FromRequest>::Error, <E as FromRequest>::Error, <F as FromRequest>::Error, <G as FromRequest>::Error, <H as FromRequest>::Error, <I as FromRequest>::Error>

Source§

async fn from_request<'r>( req: &'r RequestContext<'_, '_>, body: OptionReqBody, ) -> Result<Self::Output<'r>, Self::Error>

Source§

impl<A, B, C, D, E, F, G, H, I, J> FromRequest for (A, B, C, D, E, F, G, H, I, J)
where A: FromRequest, B: FromRequest, C: FromRequest, D: FromRequest, E: FromRequest, F: FromRequest, G: FromRequest, H: FromRequest, I: FromRequest, J: FromRequest, for<'any> A::Output<'any>: Send, for<'any> B::Output<'any>: Send, for<'any> C::Output<'any>: Send, for<'any> D::Output<'any>: Send, for<'any> E::Output<'any>: Send, for<'any> F::Output<'any>: Send, for<'any> G::Output<'any>: Send, for<'any> H::Output<'any>: Send, for<'any> I::Output<'any>: Send, for<'any> J::Output<'any>: Send,

Source§

type Output<'r> = (<A as FromRequest>::Output<'r>, <B as FromRequest>::Output<'r>, <C as FromRequest>::Output<'r>, <D as FromRequest>::Output<'r>, <E as FromRequest>::Output<'r>, <F as FromRequest>::Output<'r>, <G as FromRequest>::Output<'r>, <H as FromRequest>::Output<'r>, <I as FromRequest>::Output<'r>, <J as FromRequest>::Output<'r>)

Source§

type Error = EitherABCDEFGHIJ<<A as FromRequest>::Error, <B as FromRequest>::Error, <C as FromRequest>::Error, <D as FromRequest>::Error, <E as FromRequest>::Error, <F as FromRequest>::Error, <G as FromRequest>::Error, <H as FromRequest>::Error, <I as FromRequest>::Error, <J as FromRequest>::Error>

Source§

async fn from_request<'r>( req: &'r RequestContext<'_, '_>, body: OptionReqBody, ) -> Result<Self::Output<'r>, Self::Error>

Source§

impl<A, B, C, D, E, F, G, H, I, J, K> FromRequest for (A, B, C, D, E, F, G, H, I, J, K)
where A: FromRequest, B: FromRequest, C: FromRequest, D: FromRequest, E: FromRequest, F: FromRequest, G: FromRequest, H: FromRequest, I: FromRequest, J: FromRequest, K: FromRequest, for<'any> A::Output<'any>: Send, for<'any> B::Output<'any>: Send, for<'any> C::Output<'any>: Send, for<'any> D::Output<'any>: Send, for<'any> E::Output<'any>: Send, for<'any> F::Output<'any>: Send, for<'any> G::Output<'any>: Send, for<'any> H::Output<'any>: Send, for<'any> I::Output<'any>: Send, for<'any> J::Output<'any>: Send, for<'any> K::Output<'any>: Send,

Source§

type Output<'r> = (<A as FromRequest>::Output<'r>, <B as FromRequest>::Output<'r>, <C as FromRequest>::Output<'r>, <D as FromRequest>::Output<'r>, <E as FromRequest>::Output<'r>, <F as FromRequest>::Output<'r>, <G as FromRequest>::Output<'r>, <H as FromRequest>::Output<'r>, <I as FromRequest>::Output<'r>, <J as FromRequest>::Output<'r>, <K as FromRequest>::Output<'r>)

Source§

type Error = EitherABCDEFGHIJK<<A as FromRequest>::Error, <B as FromRequest>::Error, <C as FromRequest>::Error, <D as FromRequest>::Error, <E as FromRequest>::Error, <F as FromRequest>::Error, <G as FromRequest>::Error, <H as FromRequest>::Error, <I as FromRequest>::Error, <J as FromRequest>::Error, <K as FromRequest>::Error>

Source§

async fn from_request<'r>( req: &'r RequestContext<'_, '_>, body: OptionReqBody, ) -> Result<Self::Output<'r>, Self::Error>

Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L> FromRequest for (A, B, C, D, E, F, G, H, I, J, K, L)
where A: FromRequest, B: FromRequest, C: FromRequest, D: FromRequest, E: FromRequest, F: FromRequest, G: FromRequest, H: FromRequest, I: FromRequest, J: FromRequest, K: FromRequest, L: FromRequest, for<'any> A::Output<'any>: Send, for<'any> B::Output<'any>: Send, for<'any> C::Output<'any>: Send, for<'any> D::Output<'any>: Send, for<'any> E::Output<'any>: Send, for<'any> F::Output<'any>: Send, for<'any> G::Output<'any>: Send, for<'any> H::Output<'any>: Send, for<'any> I::Output<'any>: Send, for<'any> J::Output<'any>: Send, for<'any> K::Output<'any>: Send, for<'any> L::Output<'any>: Send,

Source§

type Output<'r> = (<A as FromRequest>::Output<'r>, <B as FromRequest>::Output<'r>, <C as FromRequest>::Output<'r>, <D as FromRequest>::Output<'r>, <E as FromRequest>::Output<'r>, <F as FromRequest>::Output<'r>, <G as FromRequest>::Output<'r>, <H as FromRequest>::Output<'r>, <I as FromRequest>::Output<'r>, <J as FromRequest>::Output<'r>, <K as FromRequest>::Output<'r>, <L as FromRequest>::Output<'r>)

Source§

type Error = EitherABCDEFGHIJKL<<A as FromRequest>::Error, <B as FromRequest>::Error, <C as FromRequest>::Error, <D as FromRequest>::Error, <E as FromRequest>::Error, <F as FromRequest>::Error, <G as FromRequest>::Error, <H as FromRequest>::Error, <I as FromRequest>::Error, <J as FromRequest>::Error, <K as FromRequest>::Error, <L as FromRequest>::Error>

Source§

async fn from_request<'r>( req: &'r RequestContext<'_, '_>, body: OptionReqBody, ) -> Result<Self::Output<'r>, Self::Error>

Source§

impl<T: FromRequest> FromRequest for Option<T>

Source§

type Output<'r> = Option<<T as FromRequest>::Output<'r>>

Source§

type Error = <T as FromRequest>::Error

Source§

async fn from_request<'r>( req: &'r RequestContext<'_, '_>, body: OptionReqBody, ) -> Result<Self::Output<'r>, Self::Error>

Source§

impl<T: FromRequest> FromRequest for Result<T, T::Error>

Source§

type Output<'r> = Result<<T as FromRequest>::Output<'r>, <T as FromRequest>::Error>

Source§

type Error = <T as FromRequest>::Error

Source§

async fn from_request<'r>( req: &'r RequestContext<'_, '_>, body: OptionReqBody, ) -> Result<Self::Output<'r>, Self::Error>

Implementors§

Source§

impl FromRequest for &PathParams<'_, '_>

Implements path parameter extraction for referenced PathParams

This implementation is similar to the owned version but works with references to PathParams. It allows handlers to receive path parameters as references directly from the request context.

Source§

type Output<'r> = &'r PathParams<'r, 'r>

Source§

type Error = ParseError

Source§

impl<T> FromRequest for Form<T>
where T: for<'de> Deserialize<'de> + Send,

Extracts form data from request body

This implementation expects the request body to be URL-encoded form data and deserializes it into the target type using serde_urlencoded.

Source§

impl<T> FromRequest for Json<T>
where T: for<'de> Deserialize<'de> + Send,

Extracts JSON data from request body

This implementation expects the request body to be valid JSON and deserializes it into the target type using serde_json.

Source§

impl<T> FromRequest for Query<T>
where T: for<'de> Deserialize<'de> + Send,

Implements query string extraction for any type that implements Deserialize

This implementation allows automatic deserialization of query string parameters into a strongly-typed struct using serde_qs.