Skip to main content

Aggregator

Trait Aggregator 

Source
pub trait Aggregator: Send + Sync {
    // Required methods
    fn accumulate(&mut self, value: Option<&Value>);
    fn finalize(&self) -> Value;
    fn reset(&mut self);
    fn new_instance(&self) -> Box<dyn Aggregator>;
    fn name(&self) -> &'static str;
}
Expand description

Trait for aggregation functions

Required Methods§

Source

fn accumulate(&mut self, value: Option<&Value>)

Process a single value

Source

fn finalize(&self) -> Value

Get the final aggregated result

Source

fn reset(&mut self)

Reset for new group

Source

fn new_instance(&self) -> Box<dyn Aggregator>

Create a fresh copy for a new group

Source

fn name(&self) -> &'static str

Name of the aggregator

Implementors§