Skip to main content

write_json

Function write_json 

Source
pub fn write_json<T>(path: &Path, prefix: &str, value: &T) -> Result<()>
where T: Serialize + ?Sized,
Expand description

Replaces path with value as pretty-printed JSON and one trailing newline, atomically and durably.

The staging file lands beside path under prefix; see create_staging_file for what a prefix may hold. path is left as it was unless the whole value serialized and reached disk.

ยงErrors