pub fn write_atomic(path: &Path, bytes: &[u8]) -> Result<(), AtomicError>Expand description
Atomically replace a regular file, preserving its permissions. On Unix a
new file starts owner-only (0600); Windows has no mode bits, so a new file
takes the directory’s inherited ACL. Symbolic links and special files are refused; parent
directories must already exist. A directory-sync error reports an uncertain
durable commit through AtomicError::commit_uncertain.
Hard links are not checked. The new file is renamed over the path, so a
target with other hard links is split from them: this path gets the new
bytes and every other link keeps the old file. A caller that needs a
hard-linked target refused writes through
DocumentFile instead, whose
ensure_mutable guard (run
by save and by a replacing create_atomic) refuses one on Unix.