pub fn write_json_atomic<T, P>(path: P, value: &T) -> Result<()>Expand description
Serializes value as compact JSON and writes it to path atomically.
Writes to a temporary file in the same directory, fsyncs it, then renames
it over path, so a concurrent reader never observes a partially written
file. Used by the quota-cache writers (the background quota workers each
persist their last-known-good snapshot).
ยงErrors
Returns an error if the parent directory cannot be created, the temp file cannot be written, or the final rename fails.