Trait kas::updatable::MatrixData[][src]

pub trait MatrixData: Debug {
    type ColKey: Clone + Debug + PartialEq<Self::ColKey> + Eq;
    type RowKey: Clone + Debug + PartialEq<Self::RowKey> + Eq;
    type Key: Clone + Debug + PartialEq<Self::Key> + Eq;
    type Item: Clone;
    fn col_len(&self) -> usize;
fn row_len(&self) -> usize;
fn contains(&self, key: &Self::Key) -> bool;
fn get_cloned(&self, key: &Self::Key) -> Option<Self::Item>;
fn update(&self, key: &Self::Key, value: Self::Item) -> Option<UpdateHandle>;
fn col_iter_vec_from(
        &self,
        start: usize,
        limit: usize
    ) -> Vec<Self::ColKey, Global>;
fn row_iter_vec_from(
        &self,
        start: usize,
        limit: usize
    ) -> Vec<Self::RowKey, Global>;
fn make_key(col: &Self::ColKey, row: &Self::RowKey) -> Self::Key; fn col_iter_vec(&self, limit: usize) -> Vec<Self::ColKey, Global> { ... }
fn row_iter_vec(&self, limit: usize) -> Vec<Self::RowKey, Global> { ... } }
Expand description

Trait for viewable data matrices

Data matrices are a kind of table where each cell has the same type.

Associated Types

Column key type

Row key type

Full key type

Item type

Required methods

Number of columns available

Note: users may assume this is O(1).

Number of rows available

Note: users may assume this is O(1).

Check whether an item with these keys exists

Get data by key (clone)

It is expected that this method succeeds when both keys are valid.

Update data, if supported

This is optional and required only to support data updates through view widgets. If implemented, then Updatable::update_handle should return a copy of the same update handle.

Returns an UpdateHandle if an update occurred. Returns None if updates are unsupported.

This method takes only &self, thus some mechanism such as RefCell is required to obtain &mut and lower to ListDataMut::set. The provider of this lowering should also provide an UpdateHandle.

Iterate over column keys as a vec

The result is the same as self.iter_vec(start + limit).skip(start).

Iterate over row keys as a vec

The result is the same as self.iter_vec(start + limit).skip(start).

Make a key from parts

Provided methods

Iterate over column keys as a vec

The result will be in deterministic implementation-defined order, with a length of max(limit, data_len) where data_len is the number of items available.

Iterate over row keys as a vec

The result will be in deterministic implementation-defined order, with a length of max(limit, data_len) where data_len is the number of items available.

Implementations on Foreign Types

Implementors