Trait kas::updatable::ListData[][src]

pub trait ListData: Debug {
    type Key: Clone + Debug + PartialEq<Self::Key> + Eq;
    type Item: Clone;
    fn len(&self) -> usize;
fn contains_key(&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 iter_vec_from(
        &self,
        start: usize,
        limit: usize
    ) -> Vec<(Self::Key, Self::Item), Global>; fn iter_vec(&self, limit: usize) -> Vec<(Self::Key, Self::Item), Global> { ... } }
Expand description

Trait for viewable data lists

Associated Types

Key type

Item type

Required methods

Number of data items available

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

Check whether a key has data

Get data by key (clone)

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 (key, value) pairs as a vec

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

Provided methods

Iterate over (key, value) pairs 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