Skip to main content

atomic_write

Function atomic_write 

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

Write bytes to path atomically: write to a unique sibling temp file, fsync, then rename over the target. A rename within a directory is atomic on POSIX, so a reader sees either the old file or the fully-written new one — never a torn write.