pub struct MultipartConfig {
pub max_size: usize,
pub max_fields: usize,
pub max_file_size: usize,
pub allowed_content_types: Vec<String>,
}Expand description
Configuration for multipart form handling
Fields§
§max_size: usizeMaximum total size of the multipart form (default: 10MB)
max_fields: usizeMaximum number of fields (default: 100)
max_file_size: usizeMaximum size per file (default: 10MB)
allowed_content_types: Vec<String>Allowed content types for files (empty = all allowed)
Implementations§
Source§impl MultipartConfig
impl MultipartConfig
Sourcepub fn new() -> MultipartConfig
pub fn new() -> MultipartConfig
Create a new multipart config with default values
Sourcepub fn max_size(self, size: usize) -> MultipartConfig
pub fn max_size(self, size: usize) -> MultipartConfig
Set the maximum total size
Sourcepub fn max_fields(self, count: usize) -> MultipartConfig
pub fn max_fields(self, count: usize) -> MultipartConfig
Set the maximum number of fields
Sourcepub fn max_file_size(self, size: usize) -> MultipartConfig
pub fn max_file_size(self, size: usize) -> MultipartConfig
Set the maximum file size
Sourcepub fn allowed_content_types(self, types: Vec<String>) -> MultipartConfig
pub fn allowed_content_types(self, types: Vec<String>) -> MultipartConfig
Set allowed content types for file uploads
Sourcepub fn allow_content_type(
self,
content_type: impl Into<String>,
) -> MultipartConfig
pub fn allow_content_type( self, content_type: impl Into<String>, ) -> MultipartConfig
Add an allowed content type
Trait Implementations§
Source§impl Clone for MultipartConfig
impl Clone for MultipartConfig
Source§fn clone(&self) -> MultipartConfig
fn clone(&self) -> MultipartConfig
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 MultipartConfig
impl Default for MultipartConfig
Source§fn default() -> MultipartConfig
fn default() -> MultipartConfig
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for MultipartConfig
impl RefUnwindSafe for MultipartConfig
impl Send for MultipartConfig
impl Sync for MultipartConfig
impl Unpin for MultipartConfig
impl UnwindSafe for MultipartConfig
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