cargo_util::paths

Function write_atomic

source
pub fn write_atomic<P: AsRef<Path>, C: AsRef<[u8]>>(
    path: P,
    contents: C,
) -> Result<()>
Expand description

Writes a file to disk atomically.

write_atomic uses tempfile::persist to accomplish atomic writes.