pub fn atomic_write(file_path: &str, content: &str) -> Result<()>Expand description
Writes content to a file atomically using a temp file and rename.
This prevents file corruption if the process is interrupted (e.g., Ctrl+C). The temp file is created in the same directory as the target file to ensure the rename operation is atomic (same filesystem).
ยงErrors
Returns an error if the temp file cannot be written or renamed.