Skip to main content

Module config_io

Module config_io 

Source

Functions§

cleanup_legacy_backups
Remove stale timestamped .bak files left by the old backup scheme. Called once at startup to clean up the accumulated backups.
load_toml_document
Loads a TOML file into an editable document, preserving comments and formatting. Returns an empty document when the file is missing or invalid.
snapshot_mtime
write_atomic
write_atomic_with_backup
write_atomic_with_backup_checked
write_toml_document
Persists an edited document via the atomic-with-backup path.
write_toml_preserving
Writes TOML config while preserving comments, formatting, key ordering, and any keys present on disk but absent from new_content (user customizations, unknown/future keys). Values from new_content are merged onto the existing document. Falls back to a plain atomic write when there is nothing to merge or the existing file cannot be parsed.
write_toml_preserving_minimal
Like write_toml_preserving, but keeps the config minimal: keys whose value equals the type’s default AND are not already present on disk are skipped, so a hand-written config is not bloated with every default key. Existing keys are always updated (preserving comments), and non-default values are always written. default_content is toml::to_string_pretty(&T::default()).