Skip to main content

OptionalFromPartsStateRefPair

Trait OptionalFromPartsStateRefPair 

pub trait OptionalFromPartsStateRefPair<State>:
    Sized
    + Send
    + Sync
    + 'static {
    type Rejection: IntoResponse;

    // Required method
    fn from_parts_state_ref_pair(
        parts: &Parts,
        state: &State,
    ) -> impl Future<Output = Result<Option<Self>, Self::Rejection>> + Send;
}
Available on crate feature http only.
Expand description

Customize the behavior of Option<Self> as a FromPartsStateRefPair extractor.

Required Associated Types§

type Rejection: IntoResponse

If the extractor fails, it will use this “rejection” type.

A rejection is a kind of error that can be converted into a response.

Required Methods§

fn from_parts_state_ref_pair( parts: &Parts, state: &State, ) -> impl Future<Output = Result<Option<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".

Implementors§

§

impl<H, State> OptionalFromPartsStateRefPair<State> for TypedHeader<H>
where H: HeaderDecode + Send + Sync + 'static, State: Send + Sync,

§

impl<T, State> OptionalFromPartsStateRefPair<State> for Query<T>
where T: DeserializeOwned + Send + Sync + 'static, State: Send + Sync,