pub trait AtomicWriteExt {
// Required method
fn atomic_write<F>(&self, write_fn: F) -> WallSwitchResult<()>
where F: FnOnce(&Path) -> WallSwitchResult<()>;
}Expand description
An extension trait to perform filesystem-safe, atomic file writes.
Required Methods§
Sourcefn atomic_write<F>(&self, write_fn: F) -> WallSwitchResult<()>
fn atomic_write<F>(&self, write_fn: F) -> WallSwitchResult<()>
Writes content to a temporary file via a closure, then atomically renames it to the destination path.
The temporary file is guaranteed to be created in the same directory as the target path, satisfying POSIX requirements for atomic renames.
§Errors
Returns a WallSwitchError::IOError if directory creation, the write closure,
or the final rename swap fails.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".