pub enum ConditionGroup {
Single(Condition),
Compound {
left: Box<ConditionGroup>,
operator: LogicalOperator,
right: Box<ConditionGroup>,
},
Not(Box<ConditionGroup>),
Exists(Box<ConditionGroup>),
Forall(Box<ConditionGroup>),
}Expand description
Group of conditions with logical operators
Variants§
Single(Condition)
A single condition
Compound
A compound condition with two sub-conditions and a logical operator
Fields
left: Box<ConditionGroup>The left side condition
operator: LogicalOperatorThe logical operator (AND, OR)
right: Box<ConditionGroup>The right side condition
Not(Box<ConditionGroup>)
A negated condition group
Exists(Box<ConditionGroup>)
Pattern matching: check if at least one fact matches the condition
Forall(Box<ConditionGroup>)
Pattern matching: check if all facts of the target type match the condition
Implementations§
Source§impl ConditionGroup
impl ConditionGroup
Sourcepub fn and(left: ConditionGroup, right: ConditionGroup) -> Self
pub fn and(left: ConditionGroup, right: ConditionGroup) -> Self
Create a compound condition using logical AND operator
Sourcepub fn or(left: ConditionGroup, right: ConditionGroup) -> Self
pub fn or(left: ConditionGroup, right: ConditionGroup) -> Self
Create a compound condition using logical OR operator
Sourcepub fn not(condition: ConditionGroup) -> Self
pub fn not(condition: ConditionGroup) -> Self
Create a negated condition using logical NOT operator
Sourcepub fn exists(condition: ConditionGroup) -> Self
pub fn exists(condition: ConditionGroup) -> Self
Create an exists condition - checks if at least one fact matches
Sourcepub fn forall(condition: ConditionGroup) -> Self
pub fn forall(condition: ConditionGroup) -> Self
Create a forall condition - checks if all facts of target type match
Sourcepub fn evaluate(&self, facts: &HashMap<String, Value>) -> bool
pub fn evaluate(&self, facts: &HashMap<String, Value>) -> bool
Evaluate this condition group against facts
Sourcepub fn evaluate_with_facts(&self, facts: &Facts) -> bool
pub fn evaluate_with_facts(&self, facts: &Facts) -> bool
Evaluate this condition group against Facts (supports pattern matching)
Trait Implementations§
Source§impl Clone for ConditionGroup
impl Clone for ConditionGroup
Source§fn clone(&self) -> ConditionGroup
fn clone(&self) -> ConditionGroup
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more