pub fn write_atomic(path: impl AsRef<Path>, content: &[u8]) -> Result<()>Expand description
Atomically replace path with content.
The parent directory is opened O_NOFOLLOW component-by-component and held
as a directory fd; the content is written to a fresh O_CREAT|O_EXCL
temp file via openat and then renameatd over the destination. A symlink
anywhere in the parent path fails the open; a symlink at the destination is
replaced by the rename, never followed (N5).