ensure_settings_keys_present

Function ensure_settings_keys_present 

Source
pub fn ensure_settings_keys_present(prefs: &Settings)
Expand description

What: Ensure all expected settings keys exist in settings.conf, appending defaults as needed.

Inputs:

  • prefs: Current in-memory settings whose values seed the file when keys are missing.

Output:

  • None.

ยงPanics

  • Panics if lines.last() is called on an empty vector after checking !lines.is_empty() (should not happen due to the check)

Details:

  • Preserves existing lines and comments while adding only absent keys.
  • Creates the settings file from the skeleton when it is missing or empty.