pub enum PatternConstraint {
Simple {
field: String,
operator: String,
value: FactValue,
},
Binding {
field: String,
variable: Variable,
},
Variable {
field: String,
operator: String,
variable: Variable,
},
MultiField {
field: String,
variable: Option<Variable>,
operator: MultifieldOp,
value: Option<FactValue>,
},
}Expand description
Pattern constraint with optional variable binding
Variants§
Simple
Simple constraint: field op value
Binding
Binding constraint: field = $var (binds value to variable)
Variable
Variable constraint: field op $var (compare with bound variable)
MultiField
Multi-field constraint: pattern matching on arrays/collections
Examples:
Order.items $?all_items- Collect all items (Collect)Product.tags contains "electronics"- Check containment (Contains)Order.items count > 0- Get array length (Count)
Implementations§
Source§impl PatternConstraint
impl PatternConstraint
Sourcepub fn simple(field: String, operator: String, value: FactValue) -> Self
pub fn simple(field: String, operator: String, value: FactValue) -> Self
Create simple constraint
Sourcepub fn variable(field: String, operator: String, variable: Variable) -> Self
pub fn variable(field: String, operator: String, variable: Variable) -> Self
Create variable constraint
Sourcepub fn multifield(
field: String,
operator: MultifieldOp,
variable: Option<Variable>,
value: Option<FactValue>,
) -> Self
pub fn multifield( field: String, operator: MultifieldOp, variable: Option<Variable>, value: Option<FactValue>, ) -> Self
Create multi-field constraint
Trait Implementations§
Source§impl Clone for PatternConstraint
impl Clone for PatternConstraint
Source§fn clone(&self) -> PatternConstraint
fn clone(&self) -> PatternConstraint
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PatternConstraint
impl RefUnwindSafe for PatternConstraint
impl Send for PatternConstraint
impl Sync for PatternConstraint
impl Unpin for PatternConstraint
impl UnwindSafe for PatternConstraint
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