pub struct StorageConfig {
pub max_file_size: Option<u64>,
pub allowed_types: Option<Vec<String>>,
pub default_cache_control: Option<String>,
pub validate_files: bool,
pub cleanup_interval: u64,
pub temp_file_max_age: u64,
}Expand description
Storage configuration
Fields§
§max_file_size: Option<u64>Maximum file size in bytes (None = unlimited)
allowed_types: Option<Vec<String>>Allowed file types (MIME type prefixes, None = all allowed)
default_cache_control: Option<String>Default cache control header
validate_files: boolEnable file validation
cleanup_interval: u64Temporary file cleanup interval (in seconds)
temp_file_max_age: u64Temporary file max age (in seconds)
Implementations§
Source§impl StorageConfig
impl StorageConfig
Sourcepub fn with_max_file_size(self, size: u64) -> Self
pub fn with_max_file_size(self, size: u64) -> Self
Set maximum file size
Sourcepub fn unlimited_file_size(self) -> Self
pub fn unlimited_file_size(self) -> Self
Remove file size limit
Sourcepub fn with_allowed_types(self, types: Vec<String>) -> Self
pub fn with_allowed_types(self, types: Vec<String>) -> Self
Set allowed file types
Sourcepub fn allow_all_types(self) -> Self
pub fn allow_all_types(self) -> Self
Allow all file types
Sourcepub fn allow_type(self, mime_type: String) -> Self
pub fn allow_type(self, mime_type: String) -> Self
Add allowed file type
Sourcepub fn with_cache_control(self, cache_control: String) -> Self
pub fn with_cache_control(self, cache_control: String) -> Self
Set default cache control
Sourcepub fn no_cache_control(self) -> Self
pub fn no_cache_control(self) -> Self
Disable cache control
Sourcepub fn with_validation(self) -> Self
pub fn with_validation(self) -> Self
Enable file validation
Sourcepub fn without_validation(self) -> Self
pub fn without_validation(self) -> Self
Disable file validation
Sourcepub fn with_cleanup_interval(self, interval: u64) -> Self
pub fn with_cleanup_interval(self, interval: u64) -> Self
Set cleanup interval
Sourcepub fn with_temp_file_max_age(self, max_age: u64) -> Self
pub fn with_temp_file_max_age(self, max_age: u64) -> Self
Set temporary file max age
Trait Implementations§
Source§impl Clone for StorageConfig
impl Clone for StorageConfig
Source§fn clone(&self) -> StorageConfig
fn clone(&self) -> StorageConfig
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 Debug for StorageConfig
impl Debug for StorageConfig
Source§impl Default for StorageConfig
impl Default for StorageConfig
Source§impl<'de> Deserialize<'de> for StorageConfig
impl<'de> Deserialize<'de> for StorageConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for StorageConfig
impl RefUnwindSafe for StorageConfig
impl Send for StorageConfig
impl Sync for StorageConfig
impl Unpin for StorageConfig
impl UnwindSafe for StorageConfig
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