Skip to main content

atomic_write

Function atomic_write 

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

Write data to path atomically: write to a temp file in the same directory, flush + sync, then rename into place.

On crash or power loss, the file either has the old content or the new content — never a partial write.