rama_http::layer::validate_request

Trait ValidateRequestFn

Source
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§

Source

type ResponseBody

The body type used for responses to unvalidated requests.

Required Methods§

Source

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.

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§

Source§

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,

Source§

type ResponseBody = ResBody

Source§

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,

Source§

type ResponseBody = ResBody

Source§

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,

Source§

type ResponseBody = ResBody

Source§

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,

Source§

type ResponseBody = ResBody