DirectoryMoveAllowedStrategies

Enum DirectoryMoveAllowedStrategies 

Source
pub enum DirectoryMoveAllowedStrategies {
    OnlyRename,
    OnlyCopyAndDelete {
        options: DirectoryMoveByCopyOptions,
    },
    Either {
        copy_and_delete_options: DirectoryMoveByCopyOptions,
    },
}
Expand description

Describes the allowed strategies for moving a directory.

This ensures at least one of “rename” or “copy-and-delete” strategies are enabled at any point. Unless you have a good reason for picking something else, Self::Either is highly recommended. It ensures we always try to rename the directory if the conditions are right, and fall back to the slower copy-and-delete strategy if that fails.

See also: DirectoryMoveOptions and move_directory.

Variants§

§

OnlyRename

Disables the move by copy-and-delete strategy, leaving only the rename strategy.

If renaming fails, for example due to source and destination being on different mount points, the corresponding function will return ExecutionError(RenameFailedAndNoFallbackStrategy).

§

OnlyCopyAndDelete

Disables the move by rename strategy, leaving only the less efficient, but more general, copy-and-delete strategy.

Fields

§options: DirectoryMoveByCopyOptions

Options for the copy-and-delete strategy.

§

Either

Enables both the rename and copy-and-delete strategies, leaving the optimal choice in the hands of the library.

Generally speaking, a rename will be attempted under the right conditions, with the copy-and-delete performed as a fallback if the rename fails.

Fields

§copy_and_delete_options: DirectoryMoveByCopyOptions

Options for the copy-and-delete strategy.

Trait Implementations§

Source§

impl Default for DirectoryMoveAllowedStrategies

Source§

fn default() -> Self

Returns the default directory move strategy configuration, which is with both rename and copy-and-delete enabled.

For details on the default copy-and-delete options, see DirectoryMoveByCopyOptions::default.

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.