pub enum BoolExpression {
Show 14 variants
Literal(bool),
GetProperty {
key: String,
fallback: bool,
},
GetState {
key: String,
fallback: bool,
},
Has(String),
Not(Box<BoolExpression>),
All(Vec<BoolExpression>),
Any(Vec<BoolExpression>),
Eq(NumericExpression, NumericExpression),
Neq(NumericExpression, NumericExpression),
Gt(NumericExpression, NumericExpression),
Gte(NumericExpression, NumericExpression),
Lt(NumericExpression, NumericExpression),
Lte(NumericExpression, NumericExpression),
StrEq(StringExpression, StringExpression),
}Expand description
A boolean expression that evaluates to bool.
Used as the condition in Case branches.
Variants§
Literal(bool)
A constant boolean literal.
GetProperty
Read a boolean feature property.
GetState
Read a boolean feature-state value.
Has(String)
Check whether a feature property key exists.
Not(Box<BoolExpression>)
Logical NOT.
All(Vec<BoolExpression>)
Logical AND (all must be true).
Any(Vec<BoolExpression>)
Logical OR (any must be true).
Eq(NumericExpression, NumericExpression)
Numeric equality: a == b.
Neq(NumericExpression, NumericExpression)
Numeric inequality: a != b.
Gt(NumericExpression, NumericExpression)
Greater than: a > b.
Gte(NumericExpression, NumericExpression)
Greater or equal: a >= b.
Lt(NumericExpression, NumericExpression)
Less than: a < b.
Lte(NumericExpression, NumericExpression)
Less or equal: a <= b.
StrEq(StringExpression, StringExpression)
String equality.
Implementations§
Source§impl BoolExpression
impl BoolExpression
Sourcepub fn eval(&self, ctx: &ExprEvalContext<'_>) -> bool
pub fn eval(&self, ctx: &ExprEvalContext<'_>) -> bool
Evaluate this boolean expression against a context.
Source§impl BoolExpression
impl BoolExpression
Sourcepub fn uses_feature_state(&self) -> bool
pub fn uses_feature_state(&self) -> bool
Whether this boolean expression references feature state.
Trait Implementations§
Source§impl Clone for BoolExpression
impl Clone for BoolExpression
Source§fn clone(&self) -> BoolExpression
fn clone(&self) -> BoolExpression
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BoolExpression
impl Debug for BoolExpression
Source§impl PartialEq for BoolExpression
impl PartialEq for BoolExpression
impl StructuralPartialEq for BoolExpression
Auto Trait Implementations§
impl Freeze for BoolExpression
impl RefUnwindSafe for BoolExpression
impl Send for BoolExpression
impl Sync for BoolExpression
impl Unpin for BoolExpression
impl UnsafeUnpin for BoolExpression
impl UnwindSafe for BoolExpression
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