Struct kas::updatable::FilteredList [−][src]
pub struct FilteredList<T, F> where
T: ListData,
F: Filter<<T as ListData>::Item>, {
pub data: T,
// some fields omitted
}
Expand description
Filter accessor over another accessor
This is an abstraction over a ListData
, applying a filter to items when
iterating and accessing.
When updating, the filter applies to the old value: if the old is included, it is replaced by the new, otherwise no replacement occurs.
Note: the key and item types are the same as those in the underlying list, thus one can also retrieve values from the underlying list directly.
Note: only Rc<FilteredList<T, F>>
implements ListData
; the Rc
wrapper is required!
Warning: this implementation is O(n)
where n = data.len()
and not well
optimised, thus is expected to be slow on large data lists.
Fields
data: T
Direct access to unfiltered data
If adjusting this, one should call FilteredList::refresh
after.
Implementations
Construct and apply filter
Refresh the view
Re-applies the filter (O(n)
where n
is the number of data elements).
Calling this directly may be useful in case the data is modified.
An update should be triggered using the returned handle.
Update and apply the filter
An update should be triggered using the returned handle.
See FilteredList::refresh
.
Trait Implementations
Check whether a key has data
pub fn get_cloned(
&self,
key: &<FilteredList<T, F> as ListData>::Key
) -> Option<<FilteredList<T, F> as ListData>::Item>
pub fn get_cloned(
&self,
key: &<FilteredList<T, F> as ListData>::Key
) -> Option<<FilteredList<T, F> as ListData>::Item>
Get data by key (clone)
pub fn update(
&self,
key: &<FilteredList<T, F> as ListData>::Key,
value: <FilteredList<T, F> as ListData>::Item
) -> Option<UpdateHandle>
pub fn update(
&self,
key: &<FilteredList<T, F> as ListData>::Key,
value: <FilteredList<T, F> as ListData>::Item
) -> Option<UpdateHandle>
Update data, if supported Read more
pub fn iter_vec_from(
&self,
start: usize,
limit: usize
) -> Vec<(<FilteredList<T, F> as ListData>::Key, <FilteredList<T, F> as ListData>::Item), Global>
pub fn iter_vec_from(
&self,
start: usize,
limit: usize
) -> Vec<(<FilteredList<T, F> as ListData>::Key, <FilteredList<T, F> as ListData>::Item), Global>
Iterate over (key, value) pairs as a vec Read more
impl<K, M, T, F> UpdatableHandler<K, M> for FilteredList<T, F> where
T: 'static + ListData + UpdatableHandler<K, M>,
F: Filter<<T as ListData>::Item>,
impl<K, M, T, F> UpdatableHandler<K, M> for FilteredList<T, F> where
T: 'static + ListData + UpdatableHandler<K, M>,
F: Filter<<T as ListData>::Item>,
Auto Trait Implementations
impl<T, F> !RefUnwindSafe for FilteredList<T, F>
impl<T, F> !Sync for FilteredList<T, F>
impl<T, F> UnwindSafe for FilteredList<T, F> where
F: UnwindSafe,
T: UnwindSafe,
<T as ListData>::Key: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn cast_trunc(self) -> T
pub fn cast_trunc(self) -> T
Cast to integer, truncating Read more
pub fn cast_nearest(self) -> T
pub fn cast_nearest(self) -> T
Cast to the nearest integer Read more
pub fn cast_floor(self) -> T
pub fn cast_floor(self) -> T
Cast the floor to an integer Read more
pub fn try_cast_trunc(self) -> Result<T, Error>
pub fn try_cast_trunc(self) -> Result<T, Error>
Try converting to integer with truncation Read more
pub fn try_cast_nearest(self) -> Result<T, Error>
pub fn try_cast_nearest(self) -> Result<T, Error>
Try converting to the nearest integer Read more
pub fn try_cast_floor(self) -> Result<T, Error>
pub fn try_cast_floor(self) -> Result<T, Error>
Try converting the floor to an integer Read more
pub fn try_cast_ceil(self) -> Result<T, Error>
pub fn try_cast_ceil(self) -> Result<T, Error>
Try convert the ceiling to an integer Read more