Skip to main content

config_tree_supervisor/
config_tree_supervisor.rs

1//! Demonstrates loading centralized YAML configuration into a supervisor spec.
2
3// Import the YAML configuration loader.
4use rust_supervisor::config::loader::load_config_state;
5
6// Define the shared example result type.
7type ExampleResult = Result<(), rust_supervisor::error::types::SupervisorError>;
8
9// Return typed supervisor errors from the example.
10/// Runs the centralized configuration example.
11fn main() -> ExampleResult {
12    // Load centralized YAML configuration.
13    let state = load_config_state("examples/config/supervisor.yaml")?;
14    // Convert configuration into a supervisor specification.
15    let spec = state.to_supervisor_spec()?;
16    // Print the derived specification for inspection.
17    println!("{spec:#?}");
18    // Finish the example successfully.
19    Ok(())
20    // End the configuration example.
21}