pub fn write_new(path: &Path, contents: &[u8], access: Access) -> Result<()>Expand description
Writes contents to path unless a file is there, atomically: a hard link from a synced
temporary file, which fails when path exists, so an existing file is never replaced and
of two concurrent writers exactly one wins. Parent directories are created.
§Errors
AlreadyExists when path exists; otherwise the filesystem’s error. The temporary file
is removed either way.