pub struct ViewSpec<R: GridRow> { /* private fields */ }Expand description
What the view shows: a filter, a quick filter and a multi-column sort, a grouping or a tree, aggregates and the expansion.
Cloning is cheap: every part is shared or small.
Implementations§
Source§impl<R: GridRow> ViewSpec<R>
impl<R: GridRow> ViewSpec<R>
Sourcepub fn with_aggregates(
self,
aggregates: impl IntoIterator<Item = (R::Column, Aggregate<R>)>,
) -> Self
pub fn with_aggregates( self, aggregates: impl IntoIterator<Item = (R::Column, Aggregate<R>)>, ) -> Self
Aggregates these columns, for group captions, group footers and the totals. A repeated column keeps its last aggregate. The aggregates survive a change of grouping or tree. A view without grouping has totals too.
Sourcepub fn aggregates(&self) -> &[(R::Column, Aggregate<R>)]
pub fn aggregates(&self) -> &[(R::Column, Aggregate<R>)]
The aggregates by column.
Sourcepub fn aggregate_columns(&self) -> ColumnSet
pub fn aggregate_columns(&self) -> ColumnSet
The columns whose changes change aggregates: the aggregated columns and what custom aggregates depend on.
Source§impl<R: GridRow> ViewSpec<R>
impl<R: GridRow> ViewSpec<R>
Sourcepub fn with_group_by(self, levels: impl IntoIterator<Item = GroupBy<R>>) -> Self
pub fn with_group_by(self, levels: impl IntoIterator<Item = GroupBy<R>>) -> Self
Groups the rows by these levels, the first one outermost. Repeated
level ids are dropped, the first one stays; an empty list turns
grouping off. Replaces a tree, as in AG Grid and DevExpress: the last
of with_group_by and Self::with_tree wins.
Sourcepub fn group_by(&self) -> &[GroupBy<R>]
pub fn group_by(&self) -> &[GroupBy<R>]
The grouping levels, the top one first; empty without grouping.
Sourcepub fn with_group_order(self, order: impl GroupOrder<R>) -> Self
pub fn with_group_order(self, order: impl GroupOrder<R>) -> Self
Sets the order of sibling groups (default KeyOrder).
Sourcepub fn group_order(&self) -> &dyn GroupOrder<R>
pub fn group_order(&self) -> &dyn GroupOrder<R>
The order of sibling groups.
Sets which groups have a footer (default NoGroupFooter).
Source§impl<R: GridRow> ViewSpec<R>
impl<R: GridRow> ViewSpec<R>
Sourcepub fn with_tree(self, tree: TreeSpec<R>) -> Self
pub fn with_tree(self, tree: TreeSpec<R>) -> Self
Shows the rows as a tree by GridRow::parent_key. Replaces a
grouping, as in AG Grid and DevExpress: the last of
Self::with_group_by and with_tree wins.
A row whose parent key no row has is an orphan and shows as a root,
as does a row that names itself. Rows whose parents form a cycle
show as roots too, with a warning in the log. Siblings follow the
view’s sort; the filters choose rows by TreeSpec::with_filter.
Source§impl<R: GridRow> ViewSpec<R>
impl<R: GridRow> ViewSpec<R>
Sourcepub fn with_sort(
self,
sort: impl IntoIterator<Item = (R::Column, SortDirection)>,
) -> Self
pub fn with_sort( self, sort: impl IntoIterator<Item = (R::Column, SortDirection)>, ) -> Self
Sorts by these columns, first one most significant. Ties keep insertion order, so the order is stable.
Sourcepub fn with_filter(
self,
depends_on: ColumnSet,
filter: impl Fn(&R) -> bool + Send + Sync + 'static,
) -> Self
pub fn with_filter( self, depends_on: ColumnSet, filter: impl Fn(&R) -> bool + Send + Sync + 'static, ) -> Self
Shows only rows for which filter returns true. depends_on lists
the columns the filter reads; pass every column when unsure. A
rebuild of a large snapshot calls filter from several threads at
once.
Sourcepub fn with_quick_filter(self, filter: Option<QuickFilter>) -> Self
pub fn with_quick_filter(self, filter: Option<QuickFilter>) -> Self
Shows only rows that also pass the quick text search; None turns
it off. A row is shown when it passes both the filter and the
quick filter.
Sourcepub fn sort(&self) -> &[(R::Column, SortDirection)]
pub fn sort(&self) -> &[(R::Column, SortDirection)]
The sort columns.
Sourcepub fn quick_filter(&self) -> Option<&QuickFilter>
pub fn quick_filter(&self) -> Option<&QuickFilter>
The quick filter, if it is on.
Sourcepub fn dependencies(&self) -> ColumnSet
pub fn dependencies(&self) -> ColumnSet
Columns whose changes can move rows: the sort columns, the columns
both filters read and, in a grouped view, the grouping columns, the
columns GroupKeys read and those the group order reads (for an
order by an aggregate, what that aggregate reads). Inserts and
removals always do.
A change of the other aggregated columns
(Self::aggregate_columns) changes values alone: the aggregate job
(ProjectionEngine::aggregate) refreshes them in the same order.
Trait Implementations§
Auto Trait Implementations§
impl<R> Freeze for ViewSpec<R>
impl<R> !RefUnwindSafe for ViewSpec<R>
impl<R> Send for ViewSpec<R>
impl<R> Sync for ViewSpec<R>
impl<R> Unpin for ViewSpec<R>
impl<R> UnsafeUnpin for ViewSpec<R>
impl<R> !UnwindSafe for ViewSpec<R>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().