pub struct BodyLimits {
pub body: usize,
pub multipart_body: u64,
pub file: u64,
pub field: usize,
pub memory_threshold: usize,
pub spool_dir: PathBuf,
}Expand description
Limits applied while reading a request body.
Built from App and Form configuration; see BodyLimits::from_options.
Fields§
§body: usizeLimit for non-multipart bodies (App.MaxBodySize).
multipart_body: u64Limit for the whole multipart body (Form.MaxRequestSize).
file: u64Limit for one uploaded file (Form.MaxFileSize).
field: usizeLimit for one text field (Form.MaxFieldSize).
memory_threshold: usizeBytes buffered in memory per file before spooling (Form.MemoryThreshold).
spool_dir: PathBufDirectory for spooled uploads (Form.TempDir).
Implementations§
Source§impl BodyLimits
impl BodyLimits
Sourcepub fn from_options(options: &AppOptions) -> Self
pub fn from_options(options: &AppOptions) -> Self
Derive limits from the merged application configuration.
A relative Form.TempDir is resolved against the application base
directory, matching how wwwroot and appsettings.json are located.
Sourcepub fn apply_spool_root(&self)
pub fn apply_spool_root(&self)
Publish the spool directory so FormFile values can be validated
wherever they are bound.
Trait Implementations§
Source§impl Clone for BodyLimits
impl Clone for BodyLimits
Source§fn clone(&self) -> BodyLimits
fn clone(&self) -> BodyLimits
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BodyLimits
impl Debug for BodyLimits
Auto Trait Implementations§
impl Freeze for BodyLimits
impl RefUnwindSafe for BodyLimits
impl Send for BodyLimits
impl Sync for BodyLimits
impl Unpin for BodyLimits
impl UnsafeUnpin for BodyLimits
impl UnwindSafe for BodyLimits
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