Skip to main content

configbuilder_pattern_loader/
feature_record.rs

1use crate::{FeatureMetadata, OverrideSource};
2
3/// A snapshot of one optional feature's resolved state.
4///
5/// Collected by [`crate::FeatureRegistry`] as each feature is loaded, so the registry
6/// can produce a startup summary of every registered feature.
7///
8/// Construct via [`crate::FeatureRecordBuilder`] rather than struct literal syntax, as
9/// new fields may be added without a semver bump.
10#[derive(Debug, Clone)]
11pub struct FeatureRecord {
12    /// The TOML section key for this feature (e.g. `"message_broker"`).
13    pub section_name: String,
14
15    /// Whether the feature resolved to enabled after applying all precedence rules.
16    pub enabled: bool,
17
18    /// Which external control overrode the natural TOML state, if any.
19    pub override_source: Option<OverrideSource>,
20
21    /// Section keys this feature declared it depends on via
22    /// [`crate::OptionalSection::requires`].
23    pub requires: &'static [&'static str],
24
25    /// Static annotations (description, owner, deprecation) declared by the
26    /// feature via [`crate::OptionalSection::metadata`].
27    pub metadata: Box<FeatureMetadata>,
28}