pub struct Files(/* private fields */);Expand description
A map of field names to their uploaded files, produced by MultipartRequest.
Files are stored by the multipart field name. Multiple files with the same field
name are supported. Use Files::get for a shared reference to the first file,
Files::file to take ownership of the first file, or Files::files to take
all files for a given field name.
Implementations§
Source§impl Files
impl Files
Sourcepub fn from_map(map: HashMap<String, Vec<UploadedFile>>) -> Self
pub fn from_map(map: HashMap<String, Vec<UploadedFile>>) -> Self
Create a Files collection from a pre-built map.
Sourcepub fn get(&self, name: &str) -> Option<&UploadedFile>
pub fn get(&self, name: &str) -> Option<&UploadedFile>
Get a shared reference to the first file under name, if any.
Sourcepub fn file(&mut self, name: &str) -> Option<UploadedFile>
pub fn file(&mut self, name: &str) -> Option<UploadedFile>
Take ownership of the first file under name.
Removes the field entry entirely if no files remain after the take.
Sourcepub fn files(&mut self, name: &str) -> Vec<UploadedFile>
pub fn files(&mut self, name: &str) -> Vec<UploadedFile>
Take ownership of all files under name.
Returns an empty Vec if name was not present.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Files
impl RefUnwindSafe for Files
impl Send for Files
impl Sync for Files
impl Unpin for Files
impl UnsafeUnpin for Files
impl UnwindSafe for Files
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