App JSON Settings
Tiny typed JSON settings persistence for Rust applications.
app-json-settings stores one Serde-serializable Rust value as a JSON settings
file. It is designed for small GUI, CLI, and local-first apps that want typed
settings without hand-written path and JSON boilerplate.
Overview
The crate focuses on a small API:
- choose a settings storage root
- optionally choose a file name
- load, save, or update one typed settings value
It intentionally stays JSON-focused and does not try to become a database, preference service, or general configuration framework.
Why / when
Use this crate when your application has a small settings struct and you want:
- first-run defaults with
load_or_default() - read-modify-write updates with
update() - atomic save by default, with direct save still available
- OS-default config locations for desktop apps
- caller-provided storage roots for tests, portable mode, or sandboxed hosts
- optional Pure UWP local-folder resolution without a default
windowsdependency
Quick start
[]
= { = "1", = ["derive"] }
= "2"
use ConfigManager;
Features / design notes
- Default build depends only on
serdeandserde_json. ConfigManager::for_app()is the recommended desktop constructor.ConfigManager::with_root_dir()is the sandbox-friendly storage seam.ConfigManager::try_with_filename()validates plain file names.SaveMode::Atomicis the default save strategy.with_filename()remains available for v2.x compatibility.- The optional
uwpfeature enablesat_uwp_local_folder()on Windows.
Examples
A small executable example set is available under examples/:
More detail
Full documentation is maintained under docs/src and can be read with mdBook.
Start with:
docs/src/quick-start.mddocs/src/examples.mddocs/src/storage-model.mddocs/src/save-behavior.mddocs/src/platform-behavior.mddocs/src/uwp.mddocs/src/api-guide.md
Acknowledgements
Depends on serde and serde_json.