Skip to main content

atomic_write_json

Function atomic_write_json 

Source
pub fn atomic_write_json<T: Serialize>(
    path: &Path,
    value: &T,
) -> Result<(), CacheError>
Expand description

Write a JSON-serializable value to path atomically: serialize into a sibling tempfile, then persist (rename on Unix, MoveFileEx on Windows). The parent directory is created on demand; a concurrent writer will always see either the old file or the new one, never a torn write.