Skip to main content

AggregateFn

Trait AggregateFn 

Source
pub trait AggregateFn<R: GridRow>:
    Send
    + Sync
    + 'static {
    // Required method
    fn aggregate(
        &self,
        column: R::Column,
        rows: &mut dyn Iterator<Item = &R>,
    ) -> OwnedValue;

    // Provided methods
    fn combine(&self, _parts: &[&OwnedValue]) -> Option<OwnedValue> { ... }
    fn depends_on(&self, column: R::Column) -> ColumnSet { ... }
    fn name(&self) -> &str { ... }
}
Expand description

A custom aggregate for Aggregate::Custom: a weighted average, a median. Called in the background, from several threads of a large rebuild, once per group.

Required Methods§

Source

fn aggregate( &self, column: R::Column, rows: &mut dyn Iterator<Item = &R>, ) -> OwnedValue

The aggregate of column over the live rows of one group, or of the whole view for the totals.

Provided Methods§

Source

fn combine(&self, _parts: &[&OwnedValue]) -> Option<OwnedValue>

The aggregate of a group from its subgroups’ aggregates, when the function allows it (a sum does, a median does not). None, the default: the group’s rows are iterated.

Source

fn depends_on(&self, column: R::Column) -> ColumnSet

The columns whose changes change the aggregate of column: that column by default.

Source

fn name(&self) -> &str

The name a tooltip and a screen reader give the aggregate (“Weighted average”); empty by default.

Implementors§