multipart::server::save

Enum SaveDir

Source
pub enum SaveDir {
    Temp(TempDir),
    Perm(PathBuf),
}
Expand description

The save directory for Entries. May be temporary (delete-on-drop) or permanent.

Variants§

§

Temp(TempDir)

This directory is temporary and will be deleted, along with its contents, when this wrapper is dropped.

§

Perm(PathBuf)

This directory is permanent and will be left on the filesystem when this wrapper is dropped.

N.B. If this directory is in the OS temporary directory then it may still be deleted at any time.

Implementations§

Source§

impl SaveDir

Source

pub fn as_path(&self) -> &Path

Get the path of this directory, either temporary or permanent.

Source

pub fn is_temporary(&self) -> bool

Returns true if this is a temporary directory which will be deleted on-drop.

Source

pub fn into_path(self) -> PathBuf

Unwrap the PathBuf from self; if this is a temporary directory, it will be converted to a permanent one.

Source

pub fn keep(&mut self)

If this SaveDir is temporary, convert it to permanent. This is a no-op if it already is permanent.

§Warning: Potential Data Loss

Even though this will prevent deletion on-drop, the temporary folder on most OSes (where this directory is created by default) can be automatically cleared by the OS at any time, usually on reboot or when free space is low.

It is recommended that you relocate the files from a request which you want to keep to a permanent folder on the filesystem.

Source

pub fn delete(self) -> Result<()>

Delete this directory and its contents, regardless of its permanence.

§Warning: Potential Data Loss

This is very likely irreversible, depending on the OS implementation.

Files deleted programmatically are deleted directly from disk, as compared to most file manager applications which use a staging area from which deleted files can be safely recovered (i.e. Windows’ Recycle Bin, OS X’s Trash Can, etc.).

Trait Implementations§

Source§

impl AsRef<Path> for SaveDir

Source§

fn as_ref(&self) -> &Path

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Debug for SaveDir

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V