pub struct FilePart {
pub headers: Headers,
pub size: Option<usize>,
pub path: PathBuf,
pub key: String,
pub write: Option<Box<dyn ReadWrite>>,
}
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
size: Option<usize>
Optionally, the size of the file. This is filled when multiparts are parsed, but is not necessary when they are generated.
path: PathBuf
§key: String
§write: Option<Box<dyn ReadWrite>>
Implementations§
Source§impl FilePart
impl FilePart
pub fn new(headers: Headers, path: PathBuf) -> FilePart
Sourcepub fn set_write<W: ReadWrite + 'static>(&mut self, w: W)
pub fn set_write<W: ReadWrite + 'static>(&mut self, w: W)
set any Write and Read impl struct to FilePart
pub fn set_path(&mut self, path: PathBuf)
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<String, Error>
pub fn filename(&self) -> Result<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§
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