Skip to main content

ViewSpec

Struct ViewSpec 

Source
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>

Source

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.

Source

pub fn aggregates(&self) -> &[(R::Column, Aggregate<R>)]

The aggregates by column.

Source

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>

Source

pub fn expansion(&self) -> &Expansion<R::Key>

The expansion the view is laid out for. The grid sets it: groups and tree rows are expanded and collapsed through the grid’s state.

Source§

impl<R: GridRow> ViewSpec<R>

Source

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.

Source

pub fn group_by(&self) -> &[GroupBy<R>]

The grouping levels, the top one first; empty without grouping.

Source

pub fn with_group_order(self, order: impl GroupOrder<R>) -> Self

Sets the order of sibling groups (default KeyOrder).

Source

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>

Source

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

pub fn tree(&self) -> Option<&TreeSpec<R>>

The tree, if the view is one.

Source§

impl<R: GridRow> ViewSpec<R>

Source

pub fn new() -> Self

No filter, insertion order.

Source

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.

Source

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.

Source

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.

Source

pub fn sort(&self) -> &[(R::Column, SortDirection)]

The sort columns.

Source

pub fn quick_filter(&self) -> Option<&QuickFilter>

The quick filter, if it is on.

Source

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§

Source§

impl<R: GridRow> Clone for ViewSpec<R>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<R: GridRow> Default for ViewSpec<R>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<R> Freeze for ViewSpec<R>
where <R as GridRow>::Column: Freeze,

§

impl<R> !RefUnwindSafe for ViewSpec<R>

§

impl<R> Send for ViewSpec<R>

§

impl<R> Sync for ViewSpec<R>

§

impl<R> Unpin for ViewSpec<R>
where <R as GridRow>::Column: Unpin,

§

impl<R> UnsafeUnpin for ViewSpec<R>
where <R as GridRow>::Column: UnsafeUnpin,

§

impl<R> !UnwindSafe for ViewSpec<R>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &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
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 T
where T: Default,

§

type NoneType = T

§

fn null_value() -> T

The none-equivalent value.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,