rama::http::layer::validate_request

Trait ValidateRequestFn

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

    // Required method
    fn call(
        &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 call( &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.

Object Safety§

This trait is not object safe.

Implementors§

§

impl<S, B, F, Fut, ResBody> ValidateRequestFn<S, B, ((), Request<B>)> for F
where S: Clone + Send + Sync + 'static, B: Send + 'static, ResBody: Send + 'static, F: Fn(Request<B>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<Request<B>, Response<ResBody>>> + Send + 'static,

§

type ResponseBody = ResBody

§

impl<S, B, F, Fut, ResBody> ValidateRequestFn<S, B, (Context<S>, Request<B>)> for F
where F: Fn(Context<S>, Request<B>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<(Context<S>, Request<B>), Response<ResBody>>> + Send + 'static,

§

type ResponseBody = ResBody

§

impl<S, B, F, Fut, ResBody> ValidateRequestFn<S, B, (Context<S>,)> for F
where S: Clone + Send + Sync + 'static, B: Send + 'static, ResBody: Send + 'static, F: Fn(Context<S>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<Context<S>, Response<ResBody>>> + Send + 'static,

§

type ResponseBody = ResBody

§

impl<S, B, F, Fut, ResBody> ValidateRequestFn<S, B, ()> for F
where S: Clone + Send + Sync + 'static, B: Send + 'static, ResBody: Send + 'static, F: Fn() -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<(), Response<ResBody>>> + Send + 'static,

§

type ResponseBody = ResBody