write_json_atomic

Function write_json_atomic 

Source
pub fn write_json_atomic<T, P>(path: P, data: &T) -> Result<(), EnvelopeError>
where T: Serialize, P: AsRef<Path>,
Expand description

Write JSON to a file atomically (write to temp, then rename)

This ensures that the file is either completely written or not modified at all, preventing corruption on crashes or power failures.