pub trait Validator<Data: Buf> {
    type Error;

    // Required method
    fn validate<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        parts: &'life1 Parts,
        buffered_body: &'life2 Data
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

The http::Request validator.

Runs over the buffered request body, so can be used to implement the request signature validation, or anything that needs a whole request available to conduct the validation.

You can provide your validation logic in this trait implementation. See the neighbouring crates for integrations with various web servers.

Required Associated Types§

source

type Error

An error that can occur during validation.

Required Methods§

source

fn validate<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, parts: &'life1 Parts, buffered_body: &'life2 Data ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Validate the request header and buffered body.

Implementations on Foreign Types§

source§

impl<T, Data> Validator<Data> for Arc<T>where T: Validator<Data> + Send + Sync, Data: Buf + Send + Sync,

§

type Error = <T as Validator<Data>>::Error

source§

fn validate<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, parts: &'life1 Parts, buffered_body: &'life2 Data ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

source§

impl<T, Data> Validator<Data> for &Twhere T: Validator<Data> + Send + Sync, Data: Buf + Send + Sync,

§

type Error = <T as Validator<Data>>::Error

source§

fn validate<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, parts: &'life1 Parts, buffered_body: &'life2 Data ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Implementors§