pub struct Pattern {
pub fact_type: String,
pub constraints: Vec<PatternConstraint>,
pub name: Option<String>,
}Expand description
A pattern matches facts of a specific type with constraints
Fields§
§fact_type: StringFact type (e.g., “Person”, “Order”)
constraints: Vec<PatternConstraint>List of constraints
name: Option<String>Optional pattern name for reference
Implementations§
Source§impl Pattern
impl Pattern
Sourcepub fn with_constraint(self, constraint: PatternConstraint) -> Self
pub fn with_constraint(self, constraint: PatternConstraint) -> Self
Add constraint
Sourcepub fn matches(
&self,
facts: &TypedFacts,
bindings: &HashMap<Variable, FactValue>,
) -> Option<HashMap<Variable, FactValue>>
pub fn matches( &self, facts: &TypedFacts, bindings: &HashMap<Variable, FactValue>, ) -> Option<HashMap<Variable, FactValue>>
Match this pattern against a fact
Sourcepub fn match_in_working_memory(
&self,
wm: &WorkingMemory,
bindings: &HashMap<Variable, FactValue>,
) -> Vec<(FactHandle, HashMap<Variable, FactValue>)>
pub fn match_in_working_memory( &self, wm: &WorkingMemory, bindings: &HashMap<Variable, FactValue>, ) -> Vec<(FactHandle, HashMap<Variable, FactValue>)>
Match pattern against working memory
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Pattern
impl RefUnwindSafe for Pattern
impl Send for Pattern
impl Sync for Pattern
impl Unpin for Pattern
impl UnwindSafe for Pattern
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