pub fn write<P: AsRef<Path>, C: AsRef<[u8]>>(path: P, contents: C) -> Result<()>
Expand description
Writes an entire buffer to a file, replacing its contents.
This function will create a new file if it does not exist.
This is a convenience function for using File::create
and Write::write_all
.
ยงErrors
This function will error if the path is invalid or for any other error according to OpenOptions::open
.