Expand description
The settings store: typed settings models stored as one JSON blob per code.
A settings model is a plain serde struct, stored as one JSON value keyed by a stable code, with compile-time-typed access. A generic, untyped get/set is also provided for the settings controller, which renders and saves any registered settings item without knowing its concrete type. The JSON is stored as text, so the store is portable across backends.
Enums§
- Preferences
Error - What reading or writing an operator’s own value can fail on.
- Settings
Error
Traits§
- Preferences
Model - A typed per-operator counterpart of
SettingsModel: the same shape, stored once per operator among their preferences rather than once per deployment.CODEis the storage key, namespaced to the module. - Settings
Model - A settings model: a serde struct with a stable storage code and a default.
Functions§
- get
- Reads the raw JSON value for a code, for the generic settings controller.
- get_for
- One operator’s raw value for
code. - load
- Loads a typed settings model, returning its
Defaultwhen unset. - load_
for - One operator’s stored model, or the default when they have none.
- save
- Upserts a typed settings model.
- save_
for - Stores one operator’s model.
- set
- Upserts the raw JSON value for a code.
- set_for
- Stores one operator’s raw value for
code.