Struct darpi_middleware::body_size_limit [−][src]
Implementations
impl body_size_limit
[src]
pub async fn body_size_limit(
r: &Request<Body>,
size: u64
) -> Result<(), PayloadError>
[src]
r: &Request<Body>,
size: u64
) -> Result<(), PayloadError>
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]
M: 'static + Sync + Send,
type HandlerArgs = u64
type Error = PayloadError
type Type = ()
fn call<'life0, 'async_trait>(
r: &'life0 mut Request<Body>,
module: Arc<M>,
ha: Self::HandlerArgs
) -> Pin<Box<dyn Future<Output = Result<Self::Type, Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
r: &'life0 mut Request<Body>,
module: Arc<M>,
ha: Self::HandlerArgs
) -> Pin<Box<dyn Future<Output = Result<Self::Type, Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Auto Trait Implementations
impl RefUnwindSafe for body_size_limit
impl Send for body_size_limit
impl Sync for body_size_limit
impl Unpin for body_size_limit
impl UnwindSafe for body_size_limit
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Any for T where
T: Any,
T: Any,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> FromQuery<T, QueryPayloadError> for T
pub fn from_query(query_str: Option<&str>) -> Result<T, QueryPayloadError> where
T: DeserializeOwned,
T: DeserializeOwned,
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Interface for T where
T: Any + Send + Sync,
[src]
T: Any + Send + Sync,
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ModuleInterface for T where
T: Any + Send + Sync,
[src]
T: Any + Send + Sync,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,