Function safe_write

Source
pub fn safe_write(
    path: impl AsRef<Path>,
    content: impl AsRef<[u8]>,
) -> Result<()>
Expand description

Safely writes content to a file using an atomic write pattern.

§Arguments

  • path - The path where the file should be written
  • content - The bytes to write to the file

§Returns

Returns io::Result<()> which is:

  • Ok(()) if the write was successful
  • Err(e) if any IO operation failed