Skip to main content

load_in_order

Macro load_in_order 

Source
macro_rules! load_in_order {
    ($registry:expr, $loader:expr, $($ty:ty),+ $(,)?) => { ... };
}
Expand description

Load a set of optional feature sections in dependency order.

Computes a topological load order from each type’s [OptionalSection::requires] declarations and calls [FeatureRegistryOps::load] in that order. All loaded values are discarded; use registry.records() after the call to inspect results.

Returns Err(ConfigError::Validation) if a dependency cycle is detected. The first load failure propagates and stops further loading.

§Examples

use configbuilder_pattern_loader::{load_in_order, DefaultLoader, FeatureRegistry, FeatureRegistryOps as _, OptionalSection};

let loader = real_loader();
let mut registry = FeatureRegistry::new();

load_in_order!(&mut registry, &loader, CacheConfig, BrokerConfig)
    .expect("dependency order must be acyclic");

registry.validate_dependencies().expect("all dependencies satisfied");
println!("{}", registry.summary());