pub struct FileInput {
pub file_name: String,
pub field_name: String,
pub size: usize,
pub content_type: String,
pub bytes: Vec<Bytes>,
pub extension: Option<String>,
pub content_disposition: ContentDisposition,
}
Fields§
§file_name: String
§field_name: String
§size: usize
§content_type: String
§bytes: Vec<Bytes>
§extension: Option<String>
§content_disposition: ContentDisposition
Implementations§
Source§impl FileInput
impl FileInput
pub fn create( headers: &HeaderMap, cd: ContentDisposition, ) -> Result<Self, MultipartError>
pub async fn save(&self, path: impl AsRef<Path>) -> Result<(), MultipartError>
pub fn validate(&self, rules: FileRules) -> Result<(), MultipartError>
Sourcepub fn calculate_size(&self) -> usize
pub fn calculate_size(&self) -> usize
Calculate the file size from bytes collected
Sourcepub fn human_size(&self) -> String
pub fn human_size(&self) -> String
Get the human-readable file size (e.g., “1.2 MB”, “300 KB”)
pub fn format_size(size_in_bytes: usize) -> String
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FileInput
impl !RefUnwindSafe for FileInput
impl Send for FileInput
impl Sync for FileInput
impl Unpin for FileInput
impl !UnwindSafe for FileInput
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