atomic_write

Function atomic_write 

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

Writes contents to path through temp_path and publishes the result atomically.

The temp file is synced before rename, so callers either see the old file or the fully-written new file. The temp file is removed on failure.