Trait ValidateRequest

pub trait ValidateRequest<S, B>:
    Send
    + Sync
    + 'static {
    type ResponseBody;

    // Required method
    fn validate(
        &self,
        ctx: Context<S>,
        request: Request<B>,
    ) -> impl Future<Output = Result<(Context<S>, Request<B>), Response<Self::ResponseBody>>> + Send;
}
Expand description

Trait for validating requests.

Required Associated Types§

type ResponseBody

The body type used for responses to unvalidated requests.

Required Methods§

fn validate( &self, ctx: Context<S>, request: Request<B>, ) -> impl Future<Output = Result<(Context<S>, Request<B>), Response<Self::ResponseBody>>> + Send

Validate the request.

If Ok(()) is returned then the request is allowed through, otherwise not.

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, B, A, F> ValidateRequest<S, B> for BoxValidateRequestFn<F, A>
where A: Send + Sync + 'static, F: ValidateRequestFn<S, B, A>,

§

impl<S, B, C> ValidateRequest<S, B> for AuthorizeContext<C>
where C: Authorizer, B: Send + 'static, S: Clone + Send + Sync + 'static,

§

impl<S, B, ResBody> ValidateRequest<S, B> for AcceptHeader<ResBody>
where S: Clone + Send + Sync + 'static, B: Send + Sync + 'static, ResBody: Default + Send + 'static,

§

type ResponseBody = ResBody