pub struct FilePart {
pub headers: Headers,
pub path: PathBuf,
pub size: Option<usize>,
/* private fields */
}Expand description
A file that is to be inserted into a multipart/* or alternatively an uploaded file that
was received as part of multipart/* parsing.
Fields§
§headers: HeadersThe headers of the part
path: PathBufA temporary file containing the file content
size: Option<usize>Optionally, the size of the file. This is filled when multiparts are parsed, but is not necessary when they are generated.
Implementations§
Source§impl FilePart
impl FilePart
pub fn new(headers: Headers, path: &Path) -> FilePart
Sourcepub fn do_not_delete_on_drop(&mut self)
pub fn do_not_delete_on_drop(&mut self)
If you do not want the file on disk to be deleted when Self drops, call this function. It will become your responsability to clean up.
Sourcepub fn create(headers: Headers) -> Result<FilePart, Error>
pub fn create(headers: Headers) -> Result<FilePart, Error>
Create a new temporary FilePart (when created this way, the file will be deleted once the FilePart object goes out of scope).
Sourcepub fn filename(&self) -> Result<Option<String>, Error>
pub fn filename(&self) -> Result<Option<String>, Error>
Filename that was specified when the file was uploaded. Returns Ok<None> if there
was no content-disposition header supplied.
Sourcepub fn content_type(&self) -> Option<Mime>
pub fn content_type(&self) -> Option<Mime>
Mime content-type specified in the header
Trait Implementations§
impl StructuralPartialEq for FilePart
Auto Trait Implementations§
impl Freeze for FilePart
impl !RefUnwindSafe for FilePart
impl Send for FilePart
impl !Sync for FilePart
impl Unpin for FilePart
impl !UnwindSafe for FilePart
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