Skip to main content

configbuilder_pattern_loader/
override_source.rs

1/// Records which external control overrode a feature's natural TOML state.
2///
3/// When [`crate::FeatureRecord::override_source`] is `Some`, the feature's
4/// enabled/disabled state was forced by one of these mechanisms rather than
5/// simple section presence.
6#[derive(Debug, Clone)]
7pub enum OverrideSource {
8    /// An environment variable forced this feature on or off.
9    EnvVar {
10        /// The full environment variable name (e.g. `CONFIGBUILDER_FEATURE_MESSAGE_BROKER`).
11        var_name: String,
12        /// The raw value that was set (e.g. `"false"`, `"true"`, `"0"`).
13        value: String,
14    },
15    /// The TOML section is present but `enabled = false` was set explicitly.
16    ExplicitTomlFlag,
17
18    /// The section was present and deserialised but `validate_enabled` failed,
19    /// and the feature's `OnError` policy is `OnError::Disable`.
20    ValidationError {
21        /// The string representation of the `validate_enabled` error.
22        reason: String,
23    },
24}