pub fn write_config<T: Serialize>(value: &T, path: &Path) -> Result<()>Expand description
Serialize a config value and write it to a file atomically.
Uses a temp file + rename to prevent partial writes on crash. If the destination already contains valid JSONC, the existing CST is reconciled with the new value so that comments and formatting around unchanged keys are preserved. Otherwise, a freshly formatted JSON document is written.