pub enum MoveDirectoryExecutionError {
UnableToAccessSource {
path: PathBuf,
error: Error,
},
EntryEscapesSourceDirectory {
path: PathBuf,
},
DestinationEntryUnexpected {
path: PathBuf,
},
CopyDirectoryError(CopyDirectoryExecutionError),
RenameFailedAndNoFallbackStrategy,
OtherIoError {
error: Error,
},
}Expand description
Directory move execution error.
Variants§
UnableToAccessSource
A file or directory inside the source directory could not be accessed.
Fields
EntryEscapesSourceDirectory
An item inside the source directory “escaped” outside of the base source directory.
§Implementation detail
This is an extremely unlikely error, because its requirement
is that std::fs::read_dir’s iterator returns a directory entry
outside the provided directory path.
Even though this seems extremely unlikely, a panic! would be
an extreme measure due to the many types of filesystems that exist.
Instead, treat this as a truly fatal error.
DestinationEntryUnexpected
A destination directory, a file, or a sub-directory inside it has changed since the preparation phase of the directory move call.
We can’t guarantee that all destination directory changes will trigger this, but some more obvious problematic ones, like a file appearing in one of the destinations we wanted to copy to, will.
This is essentially an unavoidable time-of-check time-of-use bug, but we try to catch it if possible.
The path field contains the path that already existed, causing this error.
CopyDirectoryError(CopyDirectoryExecutionError)
Directory copy execution error.
These errors can happen when a move-by-rename fails and a copy-and-delete is performed instead.
RenameFailedAndNoFallbackStrategy
Occurs when renaming is the only enabled directory move strategy, but it fails.
This commonly indicates that the source and destination directory are on different mount points, which would require copy-and-delete, and sometimes even following (instead of preserving) symbolic links.
OtherIoError
An uncategorized unrecoverable IO error.
See error field for more information.