Struct mime_multipart::FilePart
source · 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: Headers
The headers of the part
path: PathBuf
A 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