FromRequestParts

Trait FromRequestParts 

Source
pub trait FromRequestParts<S>: Sized {
    type Rejection: IntoResponse;

    // Required method
    fn from_request_parts<'life0, 'life1, 'async_trait>(
        parts: &'life0 mut Parts,
        state: &'life1 S,
    ) -> Pin<Box<dyn Future<Output = Result<Self, Self::Rejection>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
}
Expand description

Types that can be created from request parts.

Extractors that implement FromRequestParts cannot consume the request body and can thus be run in any order for handlers.

If your extractor needs to consume the request body then you should implement FromRequest and not FromRequestParts.

See axum::extract for more general docs about extractors.

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_parts<'life0, 'life1, 'async_trait>( parts: &'life0 mut Parts, state: &'life1 S, ) -> Pin<Box<dyn Future<Output = Result<Self, Self::Rejection>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

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<S> FromRequestParts<S> for ()
where S: Send + Sync,

Source§

type Rejection = Infallible

Source§

fn from_request_parts<'life0, 'life1, 'async_trait>( _: &'life0 mut Parts, _: &'life1 S, ) -> Pin<Box<dyn Future<Output = Result<(), <() as FromRequestParts<S>>::Rejection>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, (): 'async_trait,

Source§

impl<S, E1, E2> FromRequestParts<S> for Either<E1, E2>
where E1: FromRequestParts<S>, E2: FromRequestParts<S>, S: Send + Sync,

Source§

type Rejection = <E2 as FromRequestParts<S>>::Rejection

Source§

fn from_request_parts<'life0, 'life1, 'async_trait>( parts: &'life0 mut Parts, state: &'life1 S, ) -> Pin<Box<dyn Future<Output = Result<Either<E1, E2>, <Either<E1, E2> as FromRequestParts<S>>::Rejection>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Either<E1, E2>: 'async_trait,

Source§

impl<S, E1, E2, E3> FromRequestParts<S> for Either3<E1, E2, E3>
where E1: FromRequestParts<S>, E2: FromRequestParts<S>, E3: FromRequestParts<S>, S: Send + Sync,

Source§

type Rejection = <E3 as FromRequestParts<S>>::Rejection

Source§

fn from_request_parts<'life0, 'life1, 'async_trait>( parts: &'life0 mut Parts, state: &'life1 S, ) -> Pin<Box<dyn Future<Output = Result<Either3<E1, E2, E3>, <Either3<E1, E2, E3> as FromRequestParts<S>>::Rejection>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Either3<E1, E2, E3>: 'async_trait,

Source§

impl<S, E1, E2, E3, E4> FromRequestParts<S> for Either4<E1, E2, E3, E4>
where E1: FromRequestParts<S>, E2: FromRequestParts<S>, E3: FromRequestParts<S>, E4: FromRequestParts<S>, S: Send + Sync,

Source§

type Rejection = <E4 as FromRequestParts<S>>::Rejection

Source§

fn from_request_parts<'life0, 'life1, 'async_trait>( parts: &'life0 mut Parts, state: &'life1 S, ) -> Pin<Box<dyn Future<Output = Result<Either4<E1, E2, E3, E4>, <Either4<E1, E2, E3, E4> as FromRequestParts<S>>::Rejection>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Either4<E1, E2, E3, E4>: 'async_trait,

Source§

impl<S, E1, E2, E3, E4, E5> FromRequestParts<S> for Either5<E1, E2, E3, E4, E5>

Source§

type Rejection = <E5 as FromRequestParts<S>>::Rejection

Source§

fn from_request_parts<'life0, 'life1, 'async_trait>( parts: &'life0 mut Parts, state: &'life1 S, ) -> Pin<Box<dyn Future<Output = Result<Either5<E1, E2, E3, E4, E5>, <Either5<E1, E2, E3, E4, E5> as FromRequestParts<S>>::Rejection>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Either5<E1, E2, E3, E4, E5>: 'async_trait,

Source§

impl<S, E1, E2, E3, E4, E5, E6> FromRequestParts<S> for Either6<E1, E2, E3, E4, E5, E6>

Source§

type Rejection = <E6 as FromRequestParts<S>>::Rejection

Source§

fn from_request_parts<'life0, 'life1, 'async_trait>( parts: &'life0 mut Parts, state: &'life1 S, ) -> Pin<Box<dyn Future<Output = Result<Either6<E1, E2, E3, E4, E5, E6>, <Either6<E1, E2, E3, E4, E5, E6> as FromRequestParts<S>>::Rejection>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Either6<E1, E2, E3, E4, E5, E6>: 'async_trait,

Source§

impl<S, E1, E2, E3, E4, E5, E6, E7> FromRequestParts<S> for Either7<E1, E2, E3, E4, E5, E6, E7>

Source§

type Rejection = <E7 as FromRequestParts<S>>::Rejection

Source§

fn from_request_parts<'life0, 'life1, 'async_trait>( parts: &'life0 mut Parts, state: &'life1 S, ) -> Pin<Box<dyn Future<Output = Result<Either7<E1, E2, E3, E4, E5, E6, E7>, <Either7<E1, E2, E3, E4, E5, E6, E7> as FromRequestParts<S>>::Rejection>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Either7<E1, E2, E3, E4, E5, E6, E7>: 'async_trait,

Source§

impl<S, E1, E2, E3, E4, E5, E6, E7, E8> FromRequestParts<S> for Either8<E1, E2, E3, E4, E5, E6, E7, E8>

Source§

type Rejection = <E8 as FromRequestParts<S>>::Rejection

Source§

fn from_request_parts<'life0, 'life1, 'async_trait>( parts: &'life0 mut Parts, state: &'life1 S, ) -> Pin<Box<dyn Future<Output = Result<Either8<E1, E2, E3, E4, E5, E6, E7, E8>, <Either8<E1, E2, E3, E4, E5, E6, E7, E8> as FromRequestParts<S>>::Rejection>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Either8<E1, E2, E3, E4, E5, E6, E7, E8>: 'async_trait,

Source§

impl<S, T1> FromRequestParts<S> for (T1,)
where T1: FromRequestParts<S> + Send, S: Send + Sync,

Source§

type Rejection = Response<Body>

Source§

fn from_request_parts<'life0, 'life1, 'async_trait>( parts: &'life0 mut Parts, state: &'life1 S, ) -> Pin<Box<dyn Future<Output = Result<(T1,), <(T1,) as FromRequestParts<S>>::Rejection>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, (T1,): 'async_trait,

Source§

impl<S, T1, T2> FromRequestParts<S> for (T1, T2)
where T1: FromRequestParts<S> + Send, T2: FromRequestParts<S> + Send, S: Send + Sync,

Source§

type Rejection = Response<Body>

Source§

fn from_request_parts<'life0, 'life1, 'async_trait>( parts: &'life0 mut Parts, state: &'life1 S, ) -> Pin<Box<dyn Future<Output = Result<(T1, T2), <(T1, T2) as FromRequestParts<S>>::Rejection>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, (T1, T2): 'async_trait,

Source§

impl<S, T1, T2, T3> FromRequestParts<S> for (T1, T2, T3)
where T1: FromRequestParts<S> + Send, T2: FromRequestParts<S> + Send, T3: FromRequestParts<S> + Send, S: Send + Sync,

Source§

type Rejection = Response<Body>

Source§

fn from_request_parts<'life0, 'life1, 'async_trait>( parts: &'life0 mut Parts, state: &'life1 S, ) -> Pin<Box<dyn Future<Output = Result<(T1, T2, T3), <(T1, T2, T3) as FromRequestParts<S>>::Rejection>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, (T1, T2, T3): 'async_trait,

Source§

impl<S, T1, T2, T3, T4> FromRequestParts<S> for (T1, T2, T3, T4)
where T1: FromRequestParts<S> + Send, T2: FromRequestParts<S> + Send, T3: FromRequestParts<S> + Send, T4: FromRequestParts<S> + Send, S: Send + Sync,

Source§

type Rejection = Response<Body>

Source§

fn from_request_parts<'life0, 'life1, 'async_trait>( parts: &'life0 mut Parts, state: &'life1 S, ) -> Pin<Box<dyn Future<Output = Result<(T1, T2, T3, T4), <(T1, T2, T3, T4) as FromRequestParts<S>>::Rejection>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, (T1, T2, T3, T4): 'async_trait,

Source§

impl<S, T1, T2, T3, T4, T5> FromRequestParts<S> for (T1, T2, T3, T4, T5)
where T1: FromRequestParts<S> + Send, T2: FromRequestParts<S> + Send, T3: FromRequestParts<S> + Send, T4: FromRequestParts<S> + Send, T5: FromRequestParts<S> + Send, S: Send + Sync,

Source§

type Rejection = Response<Body>

Source§

fn from_request_parts<'life0, 'life1, 'async_trait>( parts: &'life0 mut Parts, state: &'life1 S, ) -> Pin<Box<dyn Future<Output = Result<(T1, T2, T3, T4, T5), <(T1, T2, T3, T4, T5) as FromRequestParts<S>>::Rejection>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, (T1, T2, T3, T4, T5): 'async_trait,

Source§

impl<S, T1, T2, T3, T4, T5, T6> FromRequestParts<S> for (T1, T2, T3, T4, T5, T6)

Source§

type Rejection = Response<Body>

Source§

fn from_request_parts<'life0, 'life1, 'async_trait>( parts: &'life0 mut Parts, state: &'life1 S, ) -> Pin<Box<dyn Future<Output = Result<(T1, T2, T3, T4, T5, T6), <(T1, T2, T3, T4, T5, T6) as FromRequestParts<S>>::Rejection>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, (T1, T2, T3, T4, T5, T6): 'async_trait,

Source§

impl<S, T1, T2, T3, T4, T5, T6, T7> FromRequestParts<S> for (T1, T2, T3, T4, T5, T6, T7)

Source§

type Rejection = Response<Body>

Source§

fn from_request_parts<'life0, 'life1, 'async_trait>( parts: &'life0 mut Parts, state: &'life1 S, ) -> Pin<Box<dyn Future<Output = Result<(T1, T2, T3, T4, T5, T6, T7), <(T1, T2, T3, T4, T5, T6, T7) as FromRequestParts<S>>::Rejection>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, (T1, T2, T3, T4, T5, T6, T7): 'async_trait,

Source§

impl<S, T1, T2, T3, T4, T5, T6, T7, T8> FromRequestParts<S> for (T1, T2, T3, T4, T5, T6, T7, T8)

Source§

type Rejection = Response<Body>

Source§

fn from_request_parts<'life0, 'life1, 'async_trait>( parts: &'life0 mut Parts, state: &'life1 S, ) -> Pin<Box<dyn Future<Output = Result<(T1, T2, T3, T4, T5, T6, T7, T8), <(T1, T2, T3, T4, T5, T6, T7, T8) as FromRequestParts<S>>::Rejection>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, (T1, T2, T3, T4, T5, T6, T7, T8): 'async_trait,

Source§

impl<S, T1, T2, T3, T4, T5, T6, T7, T8, T9> FromRequestParts<S> for (T1, T2, T3, T4, T5, T6, T7, T8, T9)

Source§

type Rejection = Response<Body>

Source§

fn from_request_parts<'life0, 'life1, 'async_trait>( parts: &'life0 mut Parts, state: &'life1 S, ) -> Pin<Box<dyn Future<Output = Result<(T1, T2, T3, T4, T5, T6, T7, T8, T9), <(T1, T2, T3, T4, T5, T6, T7, T8, T9) as FromRequestParts<S>>::Rejection>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, (T1, T2, T3, T4, T5, T6, T7, T8, T9): 'async_trait,

Source§

impl<S, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> FromRequestParts<S> for (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

Source§

type Rejection = Response<Body>

Source§

fn from_request_parts<'life0, 'life1, 'async_trait>( parts: &'life0 mut Parts, state: &'life1 S, ) -> Pin<Box<dyn Future<Output = Result<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10), <(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) as FromRequestParts<S>>::Rejection>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10): 'async_trait,

Source§

impl<S, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> FromRequestParts<S> for (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)

Source§

type Rejection = Response<Body>

Source§

fn from_request_parts<'life0, 'life1, 'async_trait>( parts: &'life0 mut Parts, state: &'life1 S, ) -> Pin<Box<dyn Future<Output = Result<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11), <(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11) as FromRequestParts<S>>::Rejection>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11): 'async_trait,

Source§

impl<S, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> FromRequestParts<S> for (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)

Source§

type Rejection = Response<Body>

Source§

fn from_request_parts<'life0, 'life1, 'async_trait>( parts: &'life0 mut Parts, state: &'life1 S, ) -> Pin<Box<dyn Future<Output = Result<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12), <(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12) as FromRequestParts<S>>::Rejection>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12): 'async_trait,

Source§

impl<S, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> FromRequestParts<S> for (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13)

Source§

type Rejection = Response<Body>

Source§

fn from_request_parts<'life0, 'life1, 'async_trait>( parts: &'life0 mut Parts, state: &'life1 S, ) -> Pin<Box<dyn Future<Output = Result<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13), <(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13) as FromRequestParts<S>>::Rejection>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13): 'async_trait,

Source§

impl<S, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> FromRequestParts<S> for (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14)

Source§

impl<S, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> FromRequestParts<S> for (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)

Source§

impl<S, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> FromRequestParts<S> for (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16)

Source§

impl<S, T> FromRequestParts<S> for Option<T>
where T: FromRequestParts<S>, S: Send + Sync,

Source§

type Rejection = Infallible

Source§

fn from_request_parts<'life0, 'life1, 'async_trait>( parts: &'life0 mut Parts, state: &'life1 S, ) -> Pin<Box<dyn Future<Output = Result<Option<T>, <Option<T> as FromRequestParts<S>>::Rejection>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Option<T>: 'async_trait,

Source§

impl<S, T> FromRequestParts<S> for Result<T, <T as FromRequestParts<S>>::Rejection>
where T: FromRequestParts<S>, S: Send + Sync,

Source§

type Rejection = Infallible

Source§

fn from_request_parts<'life0, 'life1, 'async_trait>( parts: &'life0 mut Parts, state: &'life1 S, ) -> Pin<Box<dyn Future<Output = Result<Result<T, <T as FromRequestParts<S>>::Rejection>, <Result<T, <T as FromRequestParts<S>>::Rejection> as FromRequestParts<S>>::Rejection>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Result<T, <T as FromRequestParts<S>>::Rejection>: 'async_trait,

Implementors§

Source§

impl<E, R, S> FromRequestParts<S> for WithRejection<E, R>

Source§

impl<OuterState, InnerState> FromRequestParts<OuterState> for State<InnerState>
where InnerState: FromRef<OuterState>, OuterState: Send + Sync,

Source§

impl<S> FromRequestParts<S> for Parts
where S: Send + Sync,

Source§

impl<S> FromRequestParts<S> for Extensions
where S: Send + Sync,

Source§

impl<S> FromRequestParts<S> for Method
where S: Send + Sync,

Source§

impl<S> FromRequestParts<S> for Version
where S: Send + Sync,

Source§

impl<S> FromRequestParts<S> for CookieJar
where S: Send + Sync,

Source§

impl<S> FromRequestParts<S> for HeaderMap
where S: Send + Sync,

Clone the headers from the request.

Prefer using TypedHeader to extract only the headers you need.

Source§

impl<S> FromRequestParts<S> for Host
where S: Send + Sync,

Source§

impl<S> FromRequestParts<S> for MatchedPath
where S: Send + Sync,

Source§

impl<S> FromRequestParts<S> for NestedPath
where S: Send + Sync,

Source§

impl<S> FromRequestParts<S> for OriginalUri
where S: Send + Sync,

Source§

impl<S> FromRequestParts<S> for RawPathParams
where S: Send + Sync,

Source§

impl<S> FromRequestParts<S> for RawQuery
where S: Send + Sync,

Source§

impl<S> FromRequestParts<S> for Uri
where S: Send + Sync,

Source§

impl<S, T> FromRequestParts<S> for Cached<T>
where S: Send + Sync, T: FromRequestParts<S> + Clone + Send + Sync + 'static,

Source§

impl<S, T> FromRequestParts<S> for ConnectInfo<T>
where S: Send + Sync, T: Clone + Send + Sync + 'static,

Source§

impl<T, S> FromRequestParts<S> for Extension<T>
where T: Clone + Send + Sync + 'static, S: Send + Sync,

Source§

impl<T, S> FromRequestParts<S> for OptionalPath<T>
where T: DeserializeOwned + Send + 'static, S: Send + Sync,

Source§

impl<T, S> FromRequestParts<S> for Path<T>
where T: DeserializeOwned + Send, S: Send + Sync,

Source§

impl<T, S> FromRequestParts<S> for Query<T>
where T: DeserializeOwned, S: Send + Sync,

Source§

impl<T, S> FromRequestParts<S> for TypedHeader<T>
where T: Header, S: Send + Sync,