Skip to main content

Module registry

Module registry 

Source
Expand description

Reflectable configuration registry.

Modules that read config via [Config::unmarshal_key_registered] are automatically recorded in a global registry. This enables:

  • Listing all config sections an application uses
  • Dumping the effective config (with redaction) for debugging
  • Dumping defaults for documentation
  • Future: admin /config endpoint, change notifications

§Auto-registration

use hyperi_rustlib::config;

// This automatically registers "expression" in the registry:
let cfg = config::get();
let profile: MyConfig = cfg.unmarshal_key_registered("expression").unwrap_or_default();

// Later, reflect on all registered sections:
for section in config::registry::sections() {
    println!("{}: {}", section.key, section.type_name);
}

Structs§

ConfigSection
A registered config section.

Functions§

dump_defaults
Dump all default config values as a JSON object (redacted).
dump_effective
Dump all effective config values as a JSON object (redacted).
dump_effective_unredacted
Dump effective config WITHOUT redaction (for internal/debug use only).
get_section
Get a single registered section by key.
is_registered
Check if a specific key is registered.
on_change
Subscribe to changes for a specific config key (opt-in).
register
Register a config section in the global registry.
sections
List all registered config sections, sorted by key.
update
Re-register a config section and notify listeners.