pub enum MultifieldOp {
Collect,
Contains,
Count,
First,
Last,
Index(usize),
Slice(usize, usize),
IsEmpty,
NotEmpty,
}Expand description
Multi-field operations for pattern matching
These operations enable CLIPS-style multi-field variable matching and manipulation.
Variants§
Collect
Collect all values into a variable: $?var
Example: Order.items $?all_items binds all items to $?all_items
Contains
Check if array contains a specific value
Example: Product.tags contains "electronics"
Count
Get the count/length of the array
Example: Order.items count returns the number of items
First
Get the first element of the array
Example: Order.items first returns the first item
Last
Get the last element of the array
Example: Order.items last returns the last item
Index(usize)
Get a specific element by index (0-based)
Example: Order.items[0] returns the first item
Slice(usize, usize)
Get a slice of the array [start:end]
Example: Order.items[1:3] returns items at index 1 and 2
IsEmpty
Check if array is empty
Example: Order.items empty
NotEmpty
Check if array is not empty
Example: Order.items not_empty
Implementations§
Source§impl MultifieldOp
impl MultifieldOp
Sourcepub fn evaluate(
&self,
facts: &TypedFacts,
field: &str,
value: Option<&FactValue>,
) -> Option<Vec<FactValue>>
pub fn evaluate( &self, facts: &TypedFacts, field: &str, value: Option<&FactValue>, ) -> Option<Vec<FactValue>>
Evaluate a multi-field operation on facts
Returns:
Some(Vec<FactValue>)- Collection of values (for Collect, Slice)Some(vec![FactValue::Integer(n)])- Numeric result (for Count, Index)Some(vec![FactValue::Boolean(b)])- Boolean result (for Contains, IsEmpty, etc.)None- Operation failed (field not found, invalid type, etc.)
Trait Implementations§
Source§impl Clone for MultifieldOp
impl Clone for MultifieldOp
Source§fn clone(&self) -> MultifieldOp
fn clone(&self) -> MultifieldOp
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more