Skip to main content

write_json_atomic

Function write_json_atomic 

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

Serialize value as pretty JSON and write it atomically to path.

Appends a trailing newline so the file is a complete JSON document suitable for jaq / jq without further munging.