flow::expr::relation::accum

Trait Accumulator

Source
pub trait Accumulator: Sized {
    // Required methods
    fn into_state(self) -> Vec<Value>;
    fn update(
        &mut self,
        aggr_fn: &AggregateFunc,
        value: Value,
        diff: i64,
    ) -> Result<(), EvalError>;
    fn eval(&self, aggr_fn: &AggregateFunc) -> Result<Value, EvalError>;

    // Provided method
    fn update_batch<I>(
        &mut self,
        aggr_fn: &AggregateFunc,
        value_diffs: I,
    ) -> Result<(), EvalError>
       where I: IntoIterator<Item = (Value, i64)> { ... }
}
Expand description

Accumulates values for the various types of accumulable aggregations.

Required Methods§

Source

fn into_state(self) -> Vec<Value>

Source

fn update( &mut self, aggr_fn: &AggregateFunc, value: Value, diff: i64, ) -> Result<(), EvalError>

Source

fn eval(&self, aggr_fn: &AggregateFunc) -> Result<Value, EvalError>

Provided Methods§

Source

fn update_batch<I>( &mut self, aggr_fn: &AggregateFunc, value_diffs: I, ) -> Result<(), EvalError>
where I: IntoIterator<Item = (Value, i64)>,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§