pub struct FlagPolicy {
pub min_stage: Stage,
pub overrides: BTreeMap<String, Stage>,
}Expand description
The fully-merged decision inputs for one CLI run: the minimum stage required for a node to be visible, plus any per-key overrides that force a specific effective stage regardless of the node’s declared stage.
Fields§
§min_stage: StageMinimum stage a node must meet (or exceed) to be visible.
overrides: BTreeMap<String, Stage>Per-key overrides that substitute a forced effective stage for a flag key, in place of the node’s own declared stage, when checking visibility.
Implementations§
Source§impl FlagPolicy
impl FlagPolicy
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new policy with the default minimum stage (Stage::Ga) and no
overrides.
Sourcepub fn with_min_stage(self, stage: Stage) -> Self
pub fn with_min_stage(self, stage: Stage) -> Self
Sets the minimum stage required for a node to be visible.
Sourcepub fn with_override(self, key: impl Into<String>, stage: Stage) -> Self
pub fn with_override(self, key: impl Into<String>, stage: Stage) -> Self
Adds (or replaces) a per-key override that forces an effective stage for the given flag key, regardless of the node’s own declared stage.
Sourcepub fn visible(&self, key: Option<&str>, stage: Stage) -> bool
pub fn visible(&self, key: Option<&str>, stage: Stage) -> bool
Returns whether a node is visible under this policy.
If key is Some and an override is registered for it, the override’s stage
substitutes for stage in the comparison against Self::min_stage.
Otherwise, the node’s own stage is compared directly against
Self::min_stage.
Trait Implementations§
Source§impl Clone for FlagPolicy
impl Clone for FlagPolicy
Source§fn clone(&self) -> FlagPolicy
fn clone(&self) -> FlagPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more