pub trait ProjectionEngine<R: GridRow>:
Send
+ Sync
+ 'static {
// Required method
fn rebuild(
&self,
snapshot: &StoreSnapshot<R>,
spec: &ViewSpec<R>,
) -> Projection;
// Provided methods
fn compact(
&self,
previous: &Projection,
snapshot: &StoreSnapshot<R>,
) -> Projection { ... }
fn aggregate(
&self,
previous: &Projection,
snapshot: &StoreSnapshot<R>,
spec: &ViewSpec<R>,
) -> Projection { ... }
fn expand(
&self,
previous: &Projection,
snapshot: &StoreSnapshot<R>,
spec: &ViewSpec<R>,
) -> Projection { ... }
}Expand description
Builds projections. The default is Rebuild; incremental engines
implement the same trait.
Required Methods§
Sourcefn rebuild(&self, snapshot: &StoreSnapshot<R>, spec: &ViewSpec<R>) -> Projection
fn rebuild(&self, snapshot: &StoreSnapshot<R>, spec: &ViewSpec<R>) -> Projection
Builds the display order of snapshot for spec.
Provided Methods§
Sourcefn compact(
&self,
previous: &Projection,
snapshot: &StoreSnapshot<R>,
) -> Projection
fn compact( &self, previous: &Projection, snapshot: &StoreSnapshot<R>, ) -> Projection
Drops rows removed since previous was built. Removing rows never
reorders the rest and never makes a filtered-out row visible, so this
is an O(n) filter, with no sorting. With groups it also recounts
them, drops the emptied ones and lays the lines out again with each
group’s expansion; the aggregate job (Self::aggregate) refreshes
the aggregates.
Sourcefn aggregate(
&self,
previous: &Projection,
snapshot: &StoreSnapshot<R>,
spec: &ViewSpec<R>,
) -> Projection
fn aggregate( &self, previous: &Projection, snapshot: &StoreSnapshot<R>, spec: &ViewSpec<R>, ) -> Projection
The order of previous with fresh aggregates and row counts from
snapshot. Neither reorders nor drops rows: Self::compact drops
removed ones. Groups combine their subgroups in key order, as a
rebuild does, so over the same order the result is the rebuild’s.
Sourcefn expand(
&self,
previous: &Projection,
snapshot: &StoreSnapshot<R>,
spec: &ViewSpec<R>,
) -> Projection
fn expand( &self, previous: &Projection, snapshot: &StoreSnapshot<R>, spec: &ViewSpec<R>, ) -> Projection
The order of previous laid out for spec.expansion(). The
snapshot resolves the keys of tree rows: a tree is expanded by key.