write_to_file

Function write_to_file 

Source
pub fn write_to_file(content: &str, path: &Path) -> Result<()>
Expand description

Writes string content to a file.

Creates the file if it doesn’t exist, or overwrites it if it does. Parent directories are not created automatically.

§Arguments

  • content - The string content to write
  • path - The file path to write to

§Returns

Returns Ok(()) on success.

§Errors

Returns an error if the file cannot be created or written to.