Skip to main content

save_settings

Function save_settings 

Source
pub fn save_settings(settings: &Settings) -> Result<(), String>
Expand description

Persist the honored settings back to ~/.rpi/agent/settings.json. Unknown pi fields (which Settings doesn’t model) are preserved: the current file is read as raw JSON, the known fields are overlaid, and the merged object is written — so a copied pi settings.json survives edits without losing pi-only keys. // comments are accepted using the same parser as load_settings. Missing file ⇒ a fresh object. Existing files that cannot be parsed safely are left untouched and reported as errors.