Validator

Trait Validator 

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

    // Required method
    fn validate<'a>(
        &'a self,
        parts: &'a Parts,
        buffered_body: &'a Data,
    ) -> impl Future<Output = Result<(), Self::Error>> + Send + 'a;
}
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<'a>( &'a self, parts: &'a Parts, buffered_body: &'a Data, ) -> impl Future<Output = Result<(), Self::Error>> + Send + 'a

Validate the request header and buffered body.

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<T, Data> Validator<Data> for T
where T: Deref + Send + Sync + ?Sized, <T as Deref>::Target: Validator<Data> + Send, Data: Buf + Send + Sync,

Source§

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