pub fn atomic_write(dest: &Path, bytes: &[u8]) -> Result<()>Expand description
Atomic write: stream bytes into <dest>.tmp, fsync the file and the
parent directory, then rename over dest. On POSIX the rename is
atomic. The fsync of the parent directory is what guarantees that
the rename itself survives a crash; without it, the rename’s metadata
can still be lost.