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
Required methods
fn contains_key(&self, key: &Self::Key) -> bool
fn contains_key(&self, key: &Self::Key) -> bool
Check whether a key has data
fn get_cloned(&self, key: &Self::Key) -> Option<Self::Item>
fn get_cloned(&self, key: &Self::Key) -> Option<Self::Item>
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
.