ferroui_dynamic_data/list/
source_list_ex.rs1use super::{ChangeSet, IObservableList, ISourceList};
9use std::rc::Rc;
10
11pub trait SourceListEx<T: Clone + PartialEq + 'static>: IObservableList<T> {
14 fn cast_list<U: Clone + 'static>(&self, conversion_factory: impl Fn(&T) -> U + 'static) -> Rc<dyn ferroui_system::IObservable<ChangeSet<U>>>
17 where
18 Self: ISourceList<T>,
19 {
20 ferroui_reactive::ObservableExt::select(&IObservableList::connect(self), move |changes: ChangeSet<T>| super::transform_change_set(&changes, &conversion_factory))
21 }
22
23 super::ops::defer_until_loaded::defer_until_loaded_source_methods!();
24 super::ops::expire_after::expire_after_source_methods!();
25 super::ops::limit_size_to::limit_size_to_source_methods!();
26}
27
28impl<T: Clone + PartialEq + 'static, L: IObservableList<T> + ?Sized> SourceListEx<T> for L {}