pub fn write_atomic(path: &Path, bytes: &[u8]) -> Result<()>Expand description
Write bytes to path atomically: temp file in the same directory →
sync_all → rename over the destination. The rename is atomic on the same
filesystem (and replaces an existing target on both Unix and Windows).
§Errors
Creating the parent directory, creating or writing the temp sibling,
sync_all, and the rename. On a rename failure the temp file is removed
and the destination is left exactly as it was — a failed call never leaves
a truncated target, which is the whole point of the helper.