pub struct File { /* private fields */ }
Expand description
A tempfile wrapper that includes the original filename
Implementations
sourceimpl File
impl File
pub fn into_inner(self) -> NamedTempFileⓘNotable traits for NamedTempFileimpl Read for NamedTempFileimpl<'a> Read for &'a NamedTempFileimpl<'a> Write for &'a NamedTempFileimpl Write for NamedTempFile
sourcepub fn original_file_name(&self) -> Option<&str>
pub fn original_file_name(&self) -> Option<&str>
The filename provided in the multipart/form-data request
sourcepub fn sanitized_file_name(&self) -> &str
pub fn sanitized_file_name(&self) -> &str
The sanitized version of the original file name, or generated name if none provided
sourcepub fn persist<P: AsRef<Path>>(self, dir: P) -> Result<PathBuf, Error>
👎 Deprecated since 0.5.4: Please use the ‘persist_in’ function instead
pub fn persist<P: AsRef<Path>>(self, dir: P) -> Result<PathBuf, Error>
Please use the ‘persist_in’ function instead
Persist the tempfile to an existing directory. Uses the sanitized file name and returns the full path
NOTE: Because of how temporary file is stored, it cannot be persisted across filesystems.
Also neither the file contents nor the containing directory are
synchronized, so the update may not yet have reached the disk when
persist
returns.
sourcepub fn persist_in<P: AsRef<Path>>(self, dir: P) -> Result<PathBuf, Error>
pub fn persist_in<P: AsRef<Path>>(self, dir: P) -> Result<PathBuf, Error>
Persist the tempfile to an existing directory. Uses the sanitized file name and returns the full path
NOTE: Because of how temporary file is stored, it cannot be persisted across filesystems.
Also neither the file contents nor the containing directory are
synchronized, so the update may not yet have reached the disk when
persist_in
returns.
sourcepub fn persist_at<P: AsRef<Path>>(self, path: P) -> Result<File, Error>
pub fn persist_at<P: AsRef<Path>>(self, path: P) -> Result<File, Error>
Persist the tempfile at the specified file path.
NOTE: Because of how temporary file is stored, it cannot be persisted across filesystems.
Also neither the file contents nor the containing directory are
synchronized, so the update may not yet have reached the disk when
persist_at
returns.
pub fn new(
file: NamedTempFile,
original_file_name: Option<String>,
mime_type: Option<&Mime>
) -> Self
pub fn new_with_file_name(
file: NamedTempFile,
original_file_name: String
) -> Self
sourceimpl File
impl File
sourcepub fn persist_with_permissions<P: AsRef<Path>>(
self,
dir: P,
mode: u32
) -> Result<PathBuf, Error>
pub fn persist_with_permissions<P: AsRef<Path>>(
self,
dir: P,
mode: u32
) -> Result<PathBuf, Error>
Persist the tempfile with specific permissions on Unix
NOTE: Because of how temporary file is stored, it cannot be persisted across filesystems.
Also neither the file contents nor the containing directory are
synchronized, so the update may not yet have reached the disk when
persist_with_permissions
returns.
sourcepub fn persist_with_open_permissions<P: AsRef<Path>>(
self,
dir: P
) -> Result<PathBuf, Error>
pub fn persist_with_open_permissions<P: AsRef<Path>>(
self,
dir: P
) -> Result<PathBuf, Error>
Persist the tempfile with 644 permissions on Unix
NOTE: Because of how temporary file is stored, it cannot be persisted across filesystems.
Also neither the file contents nor the containing directory are
synchronized, so the update may not yet have reached the disk when
persist_with_open_permissions
returns.
Trait Implementations
sourceimpl AsMut<NamedTempFile> for File
impl AsMut<NamedTempFile> for File
sourcefn as_mut(&mut self) -> &mut NamedTempFileⓘNotable traits for NamedTempFileimpl Read for NamedTempFileimpl<'a> Read for &'a NamedTempFileimpl<'a> Write for &'a NamedTempFileimpl Write for NamedTempFile
fn as_mut(&mut self) -> &mut NamedTempFileⓘNotable traits for NamedTempFileimpl Read for NamedTempFileimpl<'a> Read for &'a NamedTempFileimpl<'a> Write for &'a NamedTempFileimpl Write for NamedTempFile
Performs the conversion.
sourceimpl AsRef<NamedTempFile> for File
impl AsRef<NamedTempFile> for File
sourcefn as_ref(&self) -> &NamedTempFileⓘNotable traits for NamedTempFileimpl Read for NamedTempFileimpl<'a> Read for &'a NamedTempFileimpl<'a> Write for &'a NamedTempFileimpl Write for NamedTempFile
fn as_ref(&self) -> &NamedTempFileⓘNotable traits for NamedTempFileimpl Read for NamedTempFileimpl<'a> Read for &'a NamedTempFileimpl<'a> Write for &'a NamedTempFileimpl Write for NamedTempFile
Performs the conversion.
Auto Trait Implementations
impl RefUnwindSafe for File
impl Send for File
impl Sync for File
impl Unpin for File
impl UnwindSafe for File
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more