Skip to main content

Module settings

Module settings 

Source
Expand description

Descriptor-driven settings screens, and the settings store behind them.

A module registers a SettingsItem for each settings model it wants an operator to edit: its storage code (the store::SettingsModel CODE), a category it groups under, and the fields to render. The framework mounts one index that lists every registered item grouped by category, and one generic form per item that reads and writes the model’s JSON value through the store. No per-model controller is needed, exactly as a single settings controller serves every settings model.

Values are stored as one JSON object per code. Field names are JSON keys, not SQL identifiers, and the value is written through a parameterized upsert, so nothing here builds SQL from user input.

Re-exports§

pub use migrations::migrations;
pub use migrations::MODULE_ID;
pub use store::get;
pub use store::load;
pub use store::save;
pub use store::set;
pub use store::SettingsError;
pub use store::SettingsModel;

Modules§

migrations
The settings schema, as a portable migration.
store
The settings store: typed settings models stored as one JSON blob per code.

Structs§

SettingsField
One editable field of a settings model: the JSON key, its label, its widget, and optional help text shown beneath the control.
SettingsItem
A settings model surfaced in the admin: a storage code, a category and order that place it in the index, and the fields to edit.

Enums§

SettingsWidget
How a settings field is rendered and typed in the stored JSON.