pub struct AccumulatePattern {
pub result_var: String,
pub source_pattern: String,
pub extract_field: String,
pub source_conditions: Vec<String>,
pub function: Box<dyn AccumulateFunction>,
}Expand description
Accumulate pattern in a rule condition
Fields§
§result_var: StringVariable to bind the result to (e.g., “$total”)
source_pattern: StringSource pattern to match facts (e.g., “Order”)
extract_field: StringField to extract from matching facts (e.g., “amount”)
source_conditions: Vec<String>Conditions on the source pattern (e.g., “status == ‘completed’”)
function: Box<dyn AccumulateFunction>Accumulate function to apply (sum, avg, count, etc.)
Implementations§
Source§impl AccumulatePattern
impl AccumulatePattern
Sourcepub fn new(
result_var: String,
source_pattern: String,
extract_field: String,
function: Box<dyn AccumulateFunction>,
) -> Self
pub fn new( result_var: String, source_pattern: String, extract_field: String, function: Box<dyn AccumulateFunction>, ) -> Self
Create a new accumulate pattern
Sourcepub fn with_condition(self, condition: String) -> Self
pub fn with_condition(self, condition: String) -> Self
Add a condition to the source pattern
Trait Implementations§
Source§impl Clone for AccumulatePattern
impl Clone for AccumulatePattern
Auto Trait Implementations§
impl Freeze for AccumulatePattern
impl !RefUnwindSafe for AccumulatePattern
impl Send for AccumulatePattern
impl Sync for AccumulatePattern
impl Unpin for AccumulatePattern
impl !UnwindSafe for AccumulatePattern
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