Function write_file

Source
pub fn write_file<P>(path: P, content: String) -> Result<(), Error>
where P: Into<PathBuf>,
Expand description

Writes the given content to a file at the given path.

§Arguments

  • path - A PathBuf or string slice containing the path to the file to be written.
  • content - A String containing the content to be written to the file.

§Return

A Result containing a unit value if the file is written successfully, or an std::io::Error otherwise.