Skip to main content

write_file

Function write_file 

Source
pub fn write_file(path: &Path, data: &[u8]) -> Result<()>
Expand description

Writes data to a file.

§Errors

Returns any std::io::Error surfaced by File::create (parent directory missing, lacks write permission, target is a directory, …) or by File::write_all while writing the buffer.

§Examples

use std::path::Path;

use big_code_analysis::write_file;

let path = Path::new("foo.txt");
let data: [u8; 4] = [0; 4];
write_file(&path, &data).unwrap();