pub struct Flag {
pub id: String,
pub description: Option<String>,
pub variants: Vec<Variant>,
pub default_variant: Variant,
pub rules: Vec<Rule>,
pub enabled: bool,
}Expand description
A single flag.
Fields§
§id: StringStable flag identifier (also the public name).
description: Option<String>Free-form description.
variants: Vec<Variant>All possible variant names. Rules + the default must reference values from this list.
default_variant: VariantVariant returned when no rule matches.
rules: Vec<Rule>Ordered targeting rules.
enabled: boolWhen false, the evaluator skips all rules and returns
default_variant. Useful as a kill switch.
Implementations§
Source§impl Flag
impl Flag
Sourcepub fn validate(&self) -> Result<(), FeatureFlagError>
pub fn validate(&self) -> Result<(), FeatureFlagError>
Validate cross-field invariants. Called by FlagSet::validate.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Flag
impl<'de> Deserialize<'de> for Flag
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Flag
impl RefUnwindSafe for Flag
impl Send for Flag
impl Sync for Flag
impl Unpin for Flag
impl UnsafeUnpin for Flag
impl UnwindSafe for Flag
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more