Skip to main content

write_atomic

Function write_atomic 

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

Replaces path so that a crash leaves the old contents or the new ones, never part of them: the bytes are synced to a temporary file, the file is renamed, and the directory is synced so that the rename survives too.