pub struct Condition {
    pub expression: ConditionExpression,
    pub operator: Operator,
    pub value: Value,
    /* private fields */
}Expand description
Represents a single condition in a rule
Fields§
§expression: ConditionExpressionThe expression to evaluate (field or function call)
operator: OperatorThe comparison operator to use
value: ValueThe value to compare against
Implementations§
Source§impl Condition
 
impl Condition
Sourcepub fn new(field: String, operator: Operator, value: Value) -> Self
 
pub fn new(field: String, operator: Operator, value: Value) -> Self
Create a new condition with a field reference
Sourcepub fn with_function(
    function_name: String,
    args: Vec<String>,
    operator: Operator,
    value: Value,
) -> Self
 
pub fn with_function( function_name: String, args: Vec<String>, operator: Operator, value: Value, ) -> Self
Create a new condition with a function call
Sourcepub fn evaluate(&self, facts: &HashMap<String, Value>) -> bool
 
pub fn evaluate(&self, facts: &HashMap<String, Value>) -> bool
Evaluate this condition against the given facts
Sourcepub fn evaluate_with_engine(
    &self,
    facts: &HashMap<String, Value>,
    function_registry: &HashMap<String, Arc<dyn Fn(Vec<Value>, &HashMap<String, Value>) -> Result<Value> + Send + Sync>>,
) -> bool
 
pub fn evaluate_with_engine( &self, facts: &HashMap<String, Value>, function_registry: &HashMap<String, Arc<dyn Fn(Vec<Value>, &HashMap<String, Value>) -> Result<Value> + Send + Sync>>, ) -> bool
Evaluate condition with access to engine’s function registry This is needed for function call evaluation
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Condition
impl RefUnwindSafe for Condition
impl Send for Condition
impl Sync for Condition
impl Unpin for Condition
impl UnwindSafe for Condition
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