rama_http::service::web::extract

Trait FromRequestContextRefPair

Source
pub trait FromRequestContextRefPair<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<Self, Self::Rejection>> + Send;
}
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].

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_context_ref_pair( ctx: &Context<S>, parts: &Parts, ) -> impl Future<Output = Result<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.

Implementations on Foreign Types§

Source§

impl<S, T> FromRequestContextRefPair<S> for Option<T>

Implementors§

Source§

impl<S> FromRequestContextRefPair<S> for Method
where S: Clone + Send + Sync + 'static,

Source§

impl<S> FromRequestContextRefPair<S> for Authority
where S: Clone + Send + Sync + 'static,

Source§

type Rejection = MissingAuthority

Source§

impl<S> FromRequestContextRefPair<S> for Host
where S: Clone + Send + Sync + 'static,

Source§

type Rejection = MissingHost

Source§

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

Source§

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

Source§

type Rejection = PathRejection

Source§

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

Source§

type Rejection = FailedToDeserializeQueryString