Trait OptionalFromRequestContextRefPair

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

    // Required method
    fn from_request_context_ref_pair(
        ctx: &Context<S>,
        parts: &Parts,
    ) -> impl Future<Output = Result<Option<Self>, Self::Rejection>> + Send;
}
Expand description

Customize the behavior of Option<Self> as a FromRequestContextRefPair 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_request_context_ref_pair( ctx: &Context<S>, parts: &Parts, ) -> 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", so this trait is not object safe.

Implementors§

§

impl<S, H> OptionalFromRequestContextRefPair<S> for TypedHeader<H>
where S: Clone + Send + Sync + 'static, H: Header + Send + Sync + 'static,

§

impl<T, S> OptionalFromRequestContextRefPair<S> for Query<T>
where T: DeserializeOwned + Send + Sync + 'static, S: Clone + Send + Sync + 'static,