pub struct AtomicDir<T>(pub T);Expand description
A wrapper type that enables atomic writes to directories.
When writing, it first writes to a temporary directory and then renames it to the target directory, ensuring that the target directory is never left in a partially updated state.
If the write fails, the original directory remains unchanged, and the temporary directory is cleaned up, before the error is propagated.
The Vfs used for writing must support temporary directories via the
VfsSupportsTemporaryDirectories trait (or its async counterpart
VfsSupportsTemporaryDirectoriesAsync when using async writes).
Tuple Fields§
§0: TTrait Implementations§
Source§impl<'vfs, T, Vfs: Vfs<'vfs> + 'vfs> ReadFrom<'vfs, Vfs> for AtomicDir<T>where
T: ReadFrom<'vfs, Vfs>,
impl<'vfs, T, Vfs: Vfs<'vfs> + 'vfs> ReadFrom<'vfs, Vfs> for AtomicDir<T>where
T: ReadFrom<'vfs, Vfs>,
Source§impl<'vfs, T, Vfs: VfsAsync + 'vfs> ReadFromAsync<'vfs, Vfs> for AtomicDir<T>where
T: ReadFromAsync<'vfs, Vfs> + Send + 'static,
impl<'vfs, T, Vfs: VfsAsync + 'vfs> ReadFromAsync<'vfs, Vfs> for AtomicDir<T>where
T: ReadFromAsync<'vfs, Vfs> + Send + 'static,
Source§impl<'vfs, T, Vfs> WriteTo<'vfs, Vfs> for AtomicDir<T>where
T: WriteTo<'vfs, Vfs>,
Vfs: VfsSupportsTemporaryDirectories<'vfs> + Vfs<'vfs> + WriteSupportingVfs<'vfs> + 'vfs,
impl<'vfs, T, Vfs> WriteTo<'vfs, Vfs> for AtomicDir<T>where
T: WriteTo<'vfs, Vfs>,
Vfs: VfsSupportsTemporaryDirectories<'vfs> + Vfs<'vfs> + WriteSupportingVfs<'vfs> + 'vfs,
Source§impl<'vfs, T, Vfs> WriteToAsync<'vfs, Vfs> for AtomicDir<T>where
T: WriteToAsync<'vfs, Vfs> + Send + 'static,
Vfs: VfsSupportsTemporaryDirectoriesAsync<'vfs> + VfsAsync + Send + WriteSupportingVfsAsync + 'vfs,
Available on crate feature async only.
impl<'vfs, T, Vfs> WriteToAsync<'vfs, Vfs> for AtomicDir<T>where
T: WriteToAsync<'vfs, Vfs> + Send + 'static,
Vfs: VfsSupportsTemporaryDirectoriesAsync<'vfs> + VfsAsync + Send + WriteSupportingVfsAsync + 'vfs,
Available on crate feature
async only.Source§impl<'vfs, T, Vfs> WriteToAsyncRef<'vfs, Vfs> for AtomicDir<T>where
T: WriteToAsyncRef<'vfs, Vfs> + Sync + 'static,
for<'r> <T as WriteToAsyncRef<'vfs, Vfs>>::Future<'r>: Future<Output = VfsResult<(), Vfs>> + Unpin + Send + 'r,
for<'r> Vfs: VfsSupportsTemporaryDirectoriesAsync<'r> + VfsAsync + Send + 'static + WriteSupportingVfsAsync + 'vfs,
Available on crate feature async only.
impl<'vfs, T, Vfs> WriteToAsyncRef<'vfs, Vfs> for AtomicDir<T>where
T: WriteToAsyncRef<'vfs, Vfs> + Sync + 'static,
for<'r> <T as WriteToAsyncRef<'vfs, Vfs>>::Future<'r>: Future<Output = VfsResult<(), Vfs>> + Unpin + Send + 'r,
for<'r> Vfs: VfsSupportsTemporaryDirectoriesAsync<'r> + VfsAsync + Send + 'static + WriteSupportingVfsAsync + 'vfs,
Available on crate feature
async only.Auto Trait Implementations§
impl<T> Freeze for AtomicDir<T>where
T: Freeze,
impl<T> RefUnwindSafe for AtomicDir<T>where
T: RefUnwindSafe,
impl<T> Send for AtomicDir<T>where
T: Send,
impl<T> Sync for AtomicDir<T>where
T: Sync,
impl<T> Unpin for AtomicDir<T>where
T: Unpin,
impl<T> UnwindSafe for AtomicDir<T>where
T: UnwindSafe,
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
Source§impl<T> DirStructureItem for T
impl<T> DirStructureItem for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more