rust-rule-engine 1.20.1

A blazing-fast Rust rule engine with RETE algorithm, backward chaining inference, and GRL (Grule Rule Language) syntax. Features: forward/backward chaining, pattern matching, unification, O(1) rule indexing, TMS, expression evaluation, method calls, streaming with Redis state backend, watermarking, and custom functions. Production-ready for business rules, expert systems, real-time stream processing, and decision automation.
Documentation
// Test CE Demo Rules
// Demonstrates CLIPS-inspired Test CE feature

// Rule 1: Simple email validation using test CE
rule "ValidateEmail" salience 10 {
    when
        test(is_valid_email(User.email))
    then
        User.status = "valid";
        Log("Email validation passed");
}

// Rule 2: Price range check with multiple arguments
rule "CheckPriceRange" salience 5 {
    when
        test(in_range(Product.price, 100, 1000))
    then
        Product.category = "mid-range";
        Log("Product categorized as mid-range");
}

// Rule 3: Combined conditions - regular AND test CE
rule "ApproveOrder" salience 15 {
    when
        Order.amount > 100 &&
        test(is_valid_email(Customer.email))
    then
        Order.status = "approved";
        Order.discount = 50.0;
        Log("Order approved with discount");
}

// Rule 4: Multiple test CEs combined
rule "PremiumCustomer" {
    when
        test(is_valid_email(Customer.email)) &&
        test(in_range(Customer.age, 25, 65)) &&
        Customer.spending > 1000
    then
        Customer.tier = "premium";
        Log("Customer upgraded to premium");
}

// Rule 5: Negated test CE (using NOT operator)
rule "BlockInvalidEmail" {
    when
        User.checkEmail == true &&
        !test(is_valid_email(User.email))
    then
        User.status = "blocked";
        Log("Invalid email blocked");
}