pub fn safe_write(path: &Path, content: &str) -> Result<()>Expand description
Safely writes a string to a file using atomic operations.
This is a convenience wrapper around atomic_write that handles string-to-bytes conversion.
The write is atomic, meaning the file either contains the new content or the old content,
never a partial write.
§Arguments
path- The file path to write tocontent- The string content to write
§Returns
Ok(())if the file was written successfullyErrif the write operation fails
§Examples
use agpm_cli::utils::fs::safe_write;
use std::path::Path;
safe_write(Path::new("config.toml"), "[sources]\ncommunity = \"https://example.com\"")?;§See Also
atomic_writefor writing raw bytesatomic_write_multiplefor batch writing multiple files