pub fn write<P>(path: P, content: &str) -> Result<(), Error>Expand description
§Write the file
- if the file is exists, write the content to the file(which will overwrite the origin content)
- if the file is not exists, create the file and write the content to the file
- if the write process is success, return
Ok(()) - if the write process is fail, return
Err(kind like the file can not be write or no permission)
§Also
If you want to append the content to the file, use append method