Skip to main content

Module store

Module store 

Source
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§

PreferencesError
What reading or writing an operator’s own value can fail on.
SettingsError

Traits§

PreferencesModel
A typed per-operator counterpart of SettingsModel: the same shape, stored once per operator among their preferences rather than once per deployment. CODE is the storage key, namespaced to the module.
SettingsModel
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 Default when 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.