http-body-request-validator 0.2.0

The http-request-validator integration with http-body.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! [`AsBuf`] trait.

/// The ability view something as a [`bytes::Buf`].
pub trait AsBuf {
    /// The data type that implements [`bytes::Buf`] as which we can view self.
    type Data: bytes::Buf;

    /// View as [`Self::Data`] that implements [`bytes::Buf`].
    fn as_buf(&self) -> &Self::Data;
}

impl<T: bytes::Buf> AsBuf for T {
    type Data = T;

    fn as_buf(&self) -> &Self::Data {
        self
    }
}