#![no_std]
pub trait Validator<Data: bytes::Buf> {
type Error;
fn validate<'a>(
&'a self,
parts: &'a http::request::Parts,
buffered_body: &'a Data,
) -> impl core::future::Future<Output = Result<(), Self::Error>> + Send + 'a;
}
impl<T: ?Sized, Data> Validator<Data> for T
where
T: core::ops::Deref + Send + Sync,
<T as core::ops::Deref>::Target: Validator<Data> + Send,
Data: bytes::Buf + Send + Sync,
{
type Error = <<T as core::ops::Deref>::Target as Validator<Data>>::Error;
fn validate<'a>(
&'a self,
parts: &'a http::request::Parts,
buffered_body: &'a Data,
) -> impl core::future::Future<Output = Result<(), Self::Error>> + 'a {
self.deref().validate(parts, buffered_body)
}
}