Skip to main content

OptionalFromRequestParts

Trait OptionalFromRequestParts 

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

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

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

Required Associated Types§

Source

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§

Source

fn from_request_parts( parts: &mut Parts, state: &S, ) -> 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".

Implementations on Foreign Types§

Source§

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

Implementors§

Source§

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

Source§

impl<T, S> OptionalFromRequestParts<S> for Path<T>
where T: DeserializeOwned + Send + 'static, S: Send + Sync,