Skip to main content

atomic_write

Function atomic_write 

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

Durably writes contents to path.

Creates the parent directory if missing, writes to a uniquely-named temp file in the same directory, fsyncs it, then renames it over path. If anything fails after the temp file is created, the temp file is removed.