Expand description
Where the settings’ values are kept: a contract the host provides
(SettingsStore), which the Settings app calls. egui-pop holds no
storage location and no default store: without one
(super::Admin::attach_store), the values live in memory for the
session and the Settings window says so.
- Load: each scope the store holds is read when the store is
attached (
app, and a host scope when it is offered, or reloaded withsuper::Admin::reload); the values it gives become the layer’s, or the user’s own forapp. - Save: what changes in a scope the store holds is sent as the values changed, away from the UI thread (a worker thread; on the web, at once). A failing save is shown in the Settings window until a save of that scope succeeds.
- Watch: a store tells the app of changes made elsewhere (another client, another process); they are applied at the next pass, and nothing is written back.
- Claims: a store holds the settings it claims, the others stay
with the app.
CompositeStoreroutes each setting to the first handler claiming it, the rest to a default store.
FileStore keeps a scope in a JSON file whose path the host gives;
MemoryStore keeps them in memory (tests, demos, a handler for the
settings that must not outlive the session).
Structs§
- Composite
Store - An ordered list of handlers and a default store. Each setting
belongs to the first handler claiming it, else to the default; loads
merge what each one owns, saves are split by owner, and every
handler’s changes are followed. A setting claimed by two handlers is
reported once (
SettingsStore::problems); the first wins. - File
Store - A store keeping each scope in a JSON file (an object of setting ids to values) at the path the host gives. It knows no folder of its own: a scope without a path is not kept. Saving reads the file, applies the changes and replaces it whole (written beside it, then renamed). It sees no change made elsewhere.
- Memory
Store - A store keeping its scopes in memory: a handler for settings that
last the session, a stand-in in tests.
MemoryStore::changestands for a change made elsewhere: its watchers are told. Clones share the values.
Traits§
- Settings
Store - Where the settings are kept, as the host provides it. Every method
may be called from a thread other than the UI’s:
savealways is, except on the web.
Functions§
Type Aliases§
- Changes
- Values changed in a scope, by setting id:
Someits new value,Nonetaken back (back to the default, or to the layer under it). - OnChange
- Called by a store when values change elsewhere: the scope and what changed. May be called from any thread.
- Values
- A scope’s values, by setting id (
appearance.theme, not its store path).