Migrate config load/save/atomic_write to bread_utils::tomlcfg

load_doc/save_doc/atomic_write's bodies now delegate to
bread_utils::tomlcfg and bread_utils::atomic (path dependency for now, see
the TODO in Cargo.toml) instead of owning the temp-then-rename +
.bak-before-overwrite logic locally. Public function names/signatures in
config/mod.rs are unchanged, so none of the ~10 call sites across
ui/views/*.rs needed touching.

This is the other half of tonight's earlier BOS fix pass: that pass gave
breadhelp/src/config.rs its own byte-for-byte copy of this exact logic
(its own doc comment says "same discipline as bos-settings/src/config/
mod.rs::atomic_write") rather than sharing it — breadhelp's migration
follows in the next commit.

Builds clean; all 11 existing tests pass, including the atomic-write
backup/no-leftover-tmp-file test that now exercises the delegated code.
This commit is contained in:
Breadway 2026-07-17 09:30:36 +08:00
parent da6af6abf9
commit f3a5839cf1
3 changed files with 21 additions and 49 deletions

View file

@ -17,3 +17,5 @@ toml = "0.8"
# drops the rest of the user's config file.
toml_edit = "0.22"
async-channel = "2"
# TODO(owner): switch to tag-pinned git dependency once bread-utils is merged and tagged, matching the bread-theme pattern
bread-utils = { path = "../bread-ecosystem-fix-worktree/bread-utils", features = ["toml"] }