pub fn replace(path: &Path, contents: impl AsRef<[u8]>) -> Result<()>Expand description
Atomically replace a file with fully flushed bytes.
The temporary file is created beside the destination. This prevents the commit from crossing filesystems. The destination’s parent must already exist.
§Errors
Returns a contextual error when temporary creation fails. It also reports writing, synchronization, and commit failures.