Expand description
§Hot-Reloadable Configuration
Polls a TOML-like flat key=value configuration file at a configurable interval and broadcasts a new version number to all subscribers whenever the file changes (detected via mtime).
§Supported syntax
The parser handles:
- Blank lines and lines beginning with
#(comments) [section]headers (ignored — values are stored without section prefix)key = valuelines where value may be:true/false→ConfigValue::Bool- Integer literal (no
.) →ConfigValue::Int - Float literal (contains
.) →ConfigValue::Float ["a", "b"]-style list →ConfigValue::List- Anything else (including quoted strings) →
ConfigValue::String
§Example
use tokio_prompt_orchestrator::hot_config::{HotConfig, ConfigValue};
let cfg = HotConfig::from_defaults();
cfg.set("workers", ConfigValue::Int(4));
assert_eq!(cfg.get("workers"), Some(ConfigValue::Int(4)));Structs§
- Config
Snapshot - An immutable snapshot of the configuration at a point in time.
- HotConfig
- Hot-reloadable configuration object.
Enums§
- Config
Error - Errors that can occur during configuration loading or parsing.
- Config
Value - A typed configuration value.
Traits§
- From
Config Value - Fallible conversion from a
ConfigValuereference to a concrete type.
Functions§
- load_
toml - Parse a flat TOML-like key=value file into a
ConfigSnapshot.