Skip to main content

write_json_atomic_pretty

Function write_json_atomic_pretty 

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

Like write_json_atomic but pretty-prints the JSON.

Used for credential write-back so a refreshed token file keeps the human-readable 2-space layout the provider CLIs write, rather than being collapsed onto one line.

ยงErrors

Returns an error if the parent directory cannot be created, the temp file cannot be written, or the final rename fails.