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 moreSource§impl Debug for MultifieldOp
impl Debug for MultifieldOp
Source§impl PartialEq for MultifieldOp
impl PartialEq for MultifieldOp
impl StructuralPartialEq for MultifieldOp
Auto Trait Implementations§
impl Freeze for MultifieldOp
impl RefUnwindSafe for MultifieldOp
impl Send for MultifieldOp
impl Sync for MultifieldOp
impl Unpin for MultifieldOp
impl UnwindSafe for MultifieldOp
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more