pub struct BodyLimitLayer { /* private fields */ }Expand description
Body size limit middleware layer
Enforces a maximum size for request bodies. When a request body exceeds the configured limit, a 413 Payload Too Large response is returned.
Implementations§
Source§impl BodyLimitLayer
impl BodyLimitLayer
Sourcepub fn new(limit: usize) -> BodyLimitLayer
pub fn new(limit: usize) -> BodyLimitLayer
Sourcepub fn default_limit() -> BodyLimitLayer
pub fn default_limit() -> BodyLimitLayer
Create a body limit layer with the default limit (1MB)
Trait Implementations§
Source§impl Clone for BodyLimitLayer
impl Clone for BodyLimitLayer
Source§fn clone(&self) -> BodyLimitLayer
fn clone(&self) -> BodyLimitLayer
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for BodyLimitLayer
impl Default for BodyLimitLayer
Source§fn default() -> BodyLimitLayer
fn default() -> BodyLimitLayer
Returns the “default value” for a type. Read more
Source§impl MiddlewareLayer for BodyLimitLayer
impl MiddlewareLayer for BodyLimitLayer
Source§fn call(
&self,
req: Request,
next: Arc<dyn Fn(Request) -> Pin<Box<dyn Future<Output = Response<Full<Bytes>>> + Send>> + Send + Sync>,
) -> Pin<Box<dyn Future<Output = Response<Full<Bytes>>> + Send>>
fn call( &self, req: Request, next: Arc<dyn Fn(Request) -> Pin<Box<dyn Future<Output = Response<Full<Bytes>>> + Send>> + Send + Sync>, ) -> Pin<Box<dyn Future<Output = Response<Full<Bytes>>> + Send>>
Apply this middleware to a request, calling
next to continue the chainSource§fn clone_box(&self) -> Box<dyn MiddlewareLayer>
fn clone_box(&self) -> Box<dyn MiddlewareLayer>
Clone this middleware into a boxed trait object
Auto Trait Implementations§
impl Freeze for BodyLimitLayer
impl RefUnwindSafe for BodyLimitLayer
impl Send for BodyLimitLayer
impl Sync for BodyLimitLayer
impl Unpin for BodyLimitLayer
impl UnwindSafe for BodyLimitLayer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more