Struct darpi_middleware::body_size_limit[][src]

pub struct body_size_limit {}

Implementations

impl body_size_limit[src]

pub async fn body_size_limit(
    r: &Request<Body>,
    size: u64
) -> Result<(), PayloadError>
[src]

this middleware limits the request body size by a user passed argument the argument size indicates number of bytes if the body is higher than the specified size, it will result in an error response being sent to the user

#[handler([body_size_limit(64)])]
async fn say_hello(#[path] p: Name, #[body] payload: Json<Name>) -> impl Responder {
    format!("{} sends hello to {}", p.name, payload.name)
}

Trait Implementations

impl<M> RequestMiddleware<M> for body_size_limit where
    M: 'static + Sync + Send
[src]

type HandlerArgs = u64

type Error = PayloadError

type Type = ()

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Any for T where
    T: Any

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> FromQuery<T, QueryPayloadError> for T

impl<T> Instrument for T[src]

impl<T> Interface for T where
    T: Any + Send + Sync
[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ModuleInterface for T where
    T: Any + Send + Sync
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.