axum_core::extract

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 Self: 'async_trait,
             'life0: 'async_trait,
             'life1: '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 Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Perform the extraction.

Object Safety§

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<(), Self::Rejection>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

impl<S> FromRequestParts<S> for Extensions
where 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<Self, Self::Rejection>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

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§

type Rejection = Infallible

source§

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

source§

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

source§

type Rejection = Infallible

source§

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

source§

impl<S> FromRequestParts<S> for Parts
where 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<Self, Self::Rejection>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

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

source§

type Rejection = Infallible

source§

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

source§

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

source§

type Rejection = Infallible

source§

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

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<Self, Self::Rejection>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

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§

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<Self, Self::Rejection>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

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§

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<Self, Self::Rejection>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

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>, Self::Rejection>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

impl<S, T> FromRequestParts<S> for Result<T, T::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<Self, Self::Rejection>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Implementors§