BufferingValidator

Struct BufferingValidator 

Source
pub struct BufferingValidator<Bufferer, InBody, BufferedToOutBody = TrivialBufferedToOutBodyFor<Bufferer, InBody>> {
    pub bufferer: Bufferer,
    pub phantom_data: PhantomData<(fn() -> InBody, BufferedToOutBody)>,
}
Expand description

The buffering validator.

Fields§

§bufferer: Bufferer

The bufferer.

§phantom_data: PhantomData<(fn() -> InBody, BufferedToOutBody)>

The phantom data types.

Implementations§

Source§

impl<Bufferer, InBody> BufferingValidator<Bufferer, InBody, TrivialBufferedToOutBodyFor<Bufferer, InBody>>
where InBody: Body, Bufferer: Bufferer<InBody>,

Source

pub const fn new(bufferer: Bufferer) -> Self

Create a new BufferingValidator with trivial BufferedToOutBody.

Source§

impl<Bufferer, InBody, BufferedToOutBody> BufferingValidator<Bufferer, InBody, BufferedToOutBody>
where InBody: Body, Bufferer: Bufferer<InBody>,

Source

pub fn with_buffered_to_out_body<New>( self, ) -> BufferingValidator<Bufferer, InBody, New>

Change the BufferedToOutBody type.

Source§

impl<Bufferer, InBody, BufferedToOutBody> BufferingValidator<Bufferer, InBody, BufferedToOutBody>
where InBody: Body, Bufferer: Bufferer<InBody>, BufferedToOutBody: BufferedToBody<Buffered = BufferedFor<Bufferer, InBody>>,

Source

pub async fn validate<Validator>( &self, validator: Validator, req: Request<InBody>, ) -> Result<Request<BufferedToOutBody::Body>, Error<Bufferer::Error, Validator::Error>>
where Validator: Validator<DataFor<Bufferer, InBody>>,

Validate the given request.

Takes the InBody out of the request, buffers it, validates the buffered body data using the specified validator, and then converts the buffered stuff with BufferedToOutBody to get the BufferedToOutBody::Body type.

Auto Trait Implementations§

§

impl<Bufferer, InBody, BufferedToOutBody> Freeze for BufferingValidator<Bufferer, InBody, BufferedToOutBody>
where Bufferer: Freeze,

§

impl<Bufferer, InBody, BufferedToOutBody> RefUnwindSafe for BufferingValidator<Bufferer, InBody, BufferedToOutBody>
where Bufferer: RefUnwindSafe, BufferedToOutBody: RefUnwindSafe,

§

impl<Bufferer, InBody, BufferedToOutBody> Send for BufferingValidator<Bufferer, InBody, BufferedToOutBody>
where Bufferer: Send, BufferedToOutBody: Send,

§

impl<Bufferer, InBody, BufferedToOutBody> Sync for BufferingValidator<Bufferer, InBody, BufferedToOutBody>
where Bufferer: Sync, BufferedToOutBody: Sync,

§

impl<Bufferer, InBody, BufferedToOutBody> Unpin for BufferingValidator<Bufferer, InBody, BufferedToOutBody>
where Bufferer: Unpin, BufferedToOutBody: Unpin,

§

impl<Bufferer, InBody, BufferedToOutBody> UnwindSafe for BufferingValidator<Bufferer, InBody, BufferedToOutBody>
where Bufferer: UnwindSafe, BufferedToOutBody: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.