Skip to main content

create

Function create 

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

Atomically create a file without replacing an existing entry.

Complete contents are flushed to a temporary file beside the destination. The file is then committed without replacing an existing entry. The destination’s parent must already exist.

§Errors

Returns an already-exists error when the destination is present. Other creation, writing, synchronization, and commit failures are contextual.