Skip to main content

atomic_write

Function atomic_write 

Source
pub fn atomic_write(path: &Path, content: &[u8]) -> Result<()>
Expand description

Atomically replace the contents of path with content.

Writes to a temporary sibling file first, then renames it into place. On POSIX systems rename(2) is atomic within the same filesystem, so readers will either see the old content or the new content – never a partially written file.