Function fs_extra::file::write_all [−][src]
pub fn write_all<P>(path: P, content: &str) -> Result<()> where
P: AsRef<Path>,
Write String
content into inside target file.
Errors
This function will return an error in the following situations, but is not limited to just these cases:
- This
path
is not a file. - This
path
file does not exist. - The current process does not have the permission rights to access
path
.
Example
ⓘ
extern crate fs_extra; use fs_extra::file::read_to_string; write_all("foo.txt", "conents" )?; // Create file foo.txt and send content inside