pub struct FileValidator { /* private fields */ }Expand description
File validator
Implementations§
Source§impl FileValidator
impl FileValidator
Sourcepub fn new(config: ValidationConfig) -> Self
pub fn new(config: ValidationConfig) -> Self
Create a new file validator
Sourcepub fn validate_size(&self, size: u64) -> StorageResult<()>
pub fn validate_size(&self, size: u64) -> StorageResult<()>
Validate file size
Sourcepub fn validate_mime_type(&self, mime_type: &str) -> StorageResult<()>
pub fn validate_mime_type(&self, mime_type: &str) -> StorageResult<()>
Validate MIME type
Sourcepub fn validate_extension(&self, filename: &str) -> StorageResult<()>
pub fn validate_extension(&self, filename: &str) -> StorageResult<()>
Validate file extension
Sourcepub fn validate_filename(&self, filename: &str) -> StorageResult<()>
pub fn validate_filename(&self, filename: &str) -> StorageResult<()>
Validate filename
Sourcepub fn validate_content(
&self,
filename: &str,
content: &[u8],
declared_mime: &str,
) -> StorageResult<()>
pub fn validate_content( &self, filename: &str, content: &[u8], declared_mime: &str, ) -> StorageResult<()>
Validate file content (magic number checking)
Sourcepub fn validate_file(
&self,
filename: &str,
content: &[u8],
mime_type: &str,
) -> StorageResult<()>
pub fn validate_file( &self, filename: &str, content: &[u8], mime_type: &str, ) -> StorageResult<()>
Validate complete file
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FileValidator
impl RefUnwindSafe for FileValidator
impl Send for FileValidator
impl Sync for FileValidator
impl Unpin for FileValidator
impl UnwindSafe for FileValidator
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