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.

This uses tempfile::persist to accomplish atomic writes.