pub struct RuleBuilder { /* private fields */ }Expand description
Builder for constructing flag rules with multiple clauses.
Rules are evaluated in the order they were added to the flag. The first matching rule wins. Rules are evaluated after individual context targets but before the fallthrough variation.
Implementations§
Source§impl RuleBuilder
impl RuleBuilder
Sourcepub fn and_match<I>(self, attribute: impl Into<String>, values: I) -> Selfwhere
I: IntoIterator<Item = AttributeValue>,
pub fn and_match<I>(self, attribute: impl Into<String>, values: I) -> Selfwhere
I: IntoIterator<Item = AttributeValue>,
Adds another clause to the current rule for user contexts.
Multiple clauses in a rule have AND semantics - all must match for the rule to match.
Sourcepub fn and_match_context<I>(
self,
context_kind: Kind,
attribute: impl Into<String>,
values: I,
) -> Selfwhere
I: IntoIterator<Item = AttributeValue>,
pub fn and_match_context<I>(
self,
context_kind: Kind,
attribute: impl Into<String>,
values: I,
) -> Selfwhere
I: IntoIterator<Item = AttributeValue>,
Adds another clause to the current rule for a context of the specified kind.
Multiple clauses in a rule have AND semantics - all must match for the rule to match.
Sourcepub fn and_not_match<I>(self, attribute: impl Into<String>, values: I) -> Selfwhere
I: IntoIterator<Item = AttributeValue>,
pub fn and_not_match<I>(self, attribute: impl Into<String>, values: I) -> Selfwhere
I: IntoIterator<Item = AttributeValue>,
Adds a negated clause to the current rule for user contexts.
The clause must NOT match any of the values for the rule to match.
Sourcepub fn and_not_match_context<I>(
self,
context_kind: Kind,
attribute: impl Into<String>,
values: I,
) -> Selfwhere
I: IntoIterator<Item = AttributeValue>,
pub fn and_not_match_context<I>(
self,
context_kind: Kind,
attribute: impl Into<String>,
values: I,
) -> Selfwhere
I: IntoIterator<Item = AttributeValue>,
Adds a negated clause to the current rule for a context of the specified kind.
The clause must NOT match any of the values for the rule to match.
Sourcepub fn with_id(self, rule_id: impl Into<String>) -> Self
pub fn with_id(self, rule_id: impl Into<String>) -> Self
Sets a custom rule ID for this rule.
By default, rules are assigned auto-generated IDs like “rule0”, “rule1”, etc. Use this method to override with a custom ID.
Sourcepub fn then_return(self, variation: bool) -> FlagBuilder
pub fn then_return(self, variation: bool) -> FlagBuilder
Completes the rule configuration for a boolean flag.
This method adds the completed rule to the flag and returns control to the flag builder.
Sourcepub fn then_return_index(self, variation: usize) -> FlagBuilder
pub fn then_return_index(self, variation: usize) -> FlagBuilder
Completes the rule configuration with a variation index.
This method adds the completed rule to the flag and returns control to the flag builder.
Auto Trait Implementations§
impl Freeze for RuleBuilder
impl RefUnwindSafe for RuleBuilder
impl Send for RuleBuilder
impl Sync for RuleBuilder
impl Unpin for RuleBuilder
impl UnsafeUnpin for RuleBuilder
impl UnwindSafe for RuleBuilder
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more