Skip to main content

atomic_write

Function atomic_write 

Source
pub fn atomic_write(path: &Path, contents: &str) -> Result<()>
Expand description

Atomically replace path with contents.

Writes to a sibling temp file, preserves the destination’s permission bits when it already exists (#422), then renames into place (with a Windows-safe replace fallback). Best-effort removes the temp file on mid-write failure (#343).

ACL / extended attributes are not preserved (platform-specific; mode bits only).