Skip to main content

atomic_write

Function atomic_write 

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

Atomically replace path with bytes.

The temp file is created in the destination’s parent directory (same volume, so rename is atomic), fsynced, given the original’s permissions, then renamed over the destination. Temp leftovers are cleaned up on error.