safe_write

Function safe_write

Source
pub fn safe_write<P: AsRef<Path>>(path: P, content: &[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