write_json_to_file

Function write_json_to_file 

Source
pub fn write_json_to_file<T: Serialize>(data: &T) -> Result<(), Box<dyn Error>>
Expand description

Atomically writes JSON data to file with file locking.

This function:

  1. Writes data to a temporary file in the same directory
  2. Atomically renames the temp file to the target file

This ensures file integrity even if the process is interrupted.