Skip to main content

GridRow

Trait GridRow 

Source
pub trait GridRow:
    Send
    + Sync
    + 'static {
    type Key: Clone + Eq + Hash + Debug + Send + Sync + 'static;
    type Column: GridColumns;

    // Required methods
    fn key(&self) -> &Self::Key;
    fn value(&self, column: Self::Column) -> CellValue<'_>;

    // Provided methods
    fn changed_columns(&self, previous: &Self, out: &mut ColumnSet) { ... }
    fn parent_key(&self) -> Option<&Self::Key> { ... }
    fn change_direction(
        &self,
        previous: &Self,
        column: Self::Column,
    ) -> Option<ChangeDirection> { ... }
}
Expand description

A row of the grid. Rows are immutable snapshots shared through Arc.

Required Associated Types§

Source

type Key: Clone + Eq + Hash + Debug + Send + Sync + 'static

The domain key of the row.

Source

type Column: GridColumns

The columns of the row type.

Required Methods§

Source

fn key(&self) -> &Self::Key

The key of this row.

Source

fn value(&self, column: Self::Column) -> CellValue<'_>

The value of a column. Called for visible cells on every frame and for every row when sorting: it must not allocate or lock.

Provided Methods§

Source

fn changed_columns(&self, previous: &Self, out: &mut ColumnSet)

Adds to out the columns whose values differ from previous.

The default compares every column with GridRow::value; override it when the producer knows cheaper what changed. Called by ingest, and by a writer whose upsert takes the place of a pending upsert of the same key (WriteCoalescing::ByKey), under the store’s write lock: it must not lock.

Source

fn parent_key(&self) -> Option<&Self::Key>

The parent row’s key in a tree view; None for a root. Called in the background while a tree is built, and by ingest (or a writer whose upsert merges into a pending one) on every replacement of the row, to compare it with the previous version (ChangeSet::has_parent_change): it must not allocate or lock.

Source

fn change_direction( &self, previous: &Self, column: Self::Column, ) -> Option<ChangeDirection>

The direction of column after a change from previous.

The default is Up or Down when both values are numbers, by CellValue::cmp_total, and None otherwise or when they are equal. Override it for a column whose rise is bad news, such as a spread. Called for changed columns only, by ingest or by a writer whose upsert merges into a pending one: it must not allocate or lock.

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§