Skip to main content

FeatureRegistryOps

Trait FeatureRegistryOps 

Source
pub trait FeatureRegistryOps: Sized {
    // Required methods
    fn new() -> Self;
    fn on_load(&mut self, observer: impl Fn(&FeatureRecord) + 'static);
    fn load<T>(
        &mut self,
        loader: &DefaultLoader,
    ) -> Result<FeatureState<T>, ConfigError>
       where T: OptionalSection;
    fn validate_dependencies(&self) -> Result<(), ConfigError>;
    fn records(&self) -> &[FeatureRecord];
    fn summary(&self) -> FeatureSummary;
}
Expand description

Startup feature registry: collection, dependency validation, and observation.

Implemented by crate::FeatureRegistry.

Required Methods§

Source

fn new() -> Self

Create an empty registry.

Source

fn on_load(&mut self, observer: impl Fn(&FeatureRecord) + 'static)

Register a callback to observe loaded records.

Source

fn load<T>( &mut self, loader: &DefaultLoader, ) -> Result<FeatureState<T>, ConfigError>
where T: OptionalSection,

Load a feature section and record its state.

§Errors

Propagates any ConfigError returned by the loader.

Source

fn validate_dependencies(&self) -> Result<(), ConfigError>

Validate that every enabled feature’s declared dependencies are enabled.

§Errors

Returns ConfigError::Validation listing all unsatisfied dependencies.

Source

fn records(&self) -> &[FeatureRecord]

Borrow the recorded feature records.

Source

fn summary(&self) -> FeatureSummary

Build a point-in-time snapshot of the recorded features.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§