pub fn write_atomic<P: AsRef<Path>>(
path: P,
contents: impl AsRef<[u8]>,
) -> Result<()>Expand description
Write contents to path atomically via a temporary sibling file.
On success the temp file is renamed to path, which on most file systems
is an atomic operation. The temporary file is removed on failure.