pub trait SourceCacheEx<T: Clone + 'static, K: Eq + Hash + Clone + 'static>: IObservableCache<T, K> {
Show 24 methods
// Provided methods
fn cast_cache<U: Clone + 'static>(
&self,
converter: impl Fn(&T) -> U + 'static,
) -> Rc<dyn IObservable<ChangeSet<U, K>>> { ... }
fn add_or_update(&self, item: T)
where Self: ISourceCache<T, K> { ... }
fn add_or_update_with_comparer(
&self,
item: T,
equality_comparer: impl Fn(&T, &T) -> bool,
)
where Self: ISourceCache<T, K> { ... }
fn add_or_update_items(&self, items: impl IntoIterator<Item = T>)
where Self: ISourceCache<T, K> { ... }
fn add_or_update_items_with_comparer(
&self,
items: impl IntoIterator<Item = T>,
equality_comparer: impl Fn(&T, &T) -> bool,
)
where Self: ISourceCache<T, K> { ... }
fn clear(&self)
where Self: ISourceCache<T, K> { ... }
fn defer_until_loaded(&self) -> Rc<dyn IObservable<ChangeSet<T, K>>> { ... }
fn edit_diff(
&self,
all_items: impl IntoIterator<Item = T>,
are_items_equal: impl Fn(&T, &T) -> bool,
)
where Self: ISourceCache<T, K> { ... }
fn expire_after(
&self,
time_selector: impl Fn(&T) -> Option<Duration> + 'static,
) -> Rc<dyn IObservable<Vec<(K, T)>>>
where Self: ISourceCache<T, K> + Clone + Sized + 'static { ... }
fn expire_after_on(
&self,
time_selector: impl Fn(&T) -> Option<Duration> + 'static,
scheduler: Rc<dyn IScheduler>,
) -> Rc<dyn IObservable<Vec<(K, T)>>>
where Self: ISourceCache<T, K> + Clone + Sized + 'static { ... }
fn expire_after_with_polling(
&self,
time_selector: impl Fn(&T) -> Option<Duration> + 'static,
polling_interval: Option<Duration>,
) -> Rc<dyn IObservable<Vec<(K, T)>>>
where Self: ISourceCache<T, K> + Clone + Sized + 'static { ... }
fn expire_after_with_polling_on(
&self,
time_selector: impl Fn(&T) -> Option<Duration> + 'static,
polling_interval: Option<Duration>,
scheduler: Rc<dyn IScheduler>,
) -> Rc<dyn IObservable<Vec<(K, T)>>>
where Self: ISourceCache<T, K> + Clone + Sized + 'static { ... }
fn limit_size_to(
&self,
size_limit: usize,
) -> Rc<dyn IObservable<Vec<(K, T)>>>
where Self: ISourceCache<T, K> + Clone + Sized + 'static { ... }
fn limit_size_to_on(
&self,
size_limit: usize,
scheduler: Rc<dyn IScheduler>,
) -> Rc<dyn IObservable<Vec<(K, T)>>>
where Self: ISourceCache<T, K> + Clone + Sized + 'static { ... }
fn populate_from(
&self,
observable: Rc<dyn IObservable<T>>,
) -> Rc<dyn IDisposable>
where Self: ISourceCache<T, K> + Clone + Sized + 'static { ... }
fn populate_from_many<I: IntoIterator<Item = T> + 'static>(
&self,
observable: Rc<dyn IObservable<I>>,
) -> Rc<dyn IDisposable>
where Self: ISourceCache<T, K> + Clone + Sized + 'static { ... }
fn refresh(&self, item: &T)
where Self: ISourceCache<T, K> { ... }
fn refresh_items(&self, items: impl IntoIterator<Item = T>)
where Self: ISourceCache<T, K> { ... }
fn refresh_all(&self)
where Self: ISourceCache<T, K> { ... }
fn remove(&self, item: &T)
where Self: ISourceCache<T, K> { ... }
fn remove_items(&self, items: impl IntoIterator<Item = T>)
where Self: ISourceCache<T, K> { ... }
fn remove_key(&self, key: K)
where Self: ISourceCache<T, K> { ... }
fn remove_keys(&self, keys: impl IntoIterator<Item = K>)
where Self: ISourceCache<T, K> { ... }
fn watch_value(&self, key: K) -> Rc<dyn IObservable<T>> { ... }
}Expand description
The operators and edit conveniences of caches (SourceCacheEx, and the extension methods of
ObservableCacheEx on IObservableCache and ISourceCache).
Provided Methods§
Sourcefn cast_cache<U: Clone + 'static>(
&self,
converter: impl Fn(&T) -> U + 'static,
) -> Rc<dyn IObservable<ChangeSet<U, K>>>
fn cast_cache<U: Clone + 'static>( &self, converter: impl Fn(&T) -> U + 'static, ) -> Rc<dyn IObservable<ChangeSet<U, K>>>
The items and their changes, each item converted by converter
(Cast(IObservableCache<TSource, TKey>, Func<TSource, TDestination>)).
Sourcefn add_or_update(&self, item: T)where
Self: ISourceCache<T, K>,
fn add_or_update(&self, item: T)where
Self: ISourceCache<T, K>,
Adds item, or replaces the item of its key (AddOrUpdate(TObject)).
Sourcefn add_or_update_with_comparer(
&self,
item: T,
equality_comparer: impl Fn(&T, &T) -> bool,
)where
Self: ISourceCache<T, K>,
fn add_or_update_with_comparer(
&self,
item: T,
equality_comparer: impl Fn(&T, &T) -> bool,
)where
Self: ISourceCache<T, K>,
add_or_update that leaves an equal item, by equality_comparer,
as it is (AddOrUpdate(TObject, IEqualityComparer<TObject>)).
Sourcefn add_or_update_items(&self, items: impl IntoIterator<Item = T>)where
Self: ISourceCache<T, K>,
fn add_or_update_items(&self, items: impl IntoIterator<Item = T>)where
Self: ISourceCache<T, K>,
Adds the items, or replaces the items of their keys (AddOrUpdate(IEnumerable<TObject>)).
Sourcefn add_or_update_items_with_comparer(
&self,
items: impl IntoIterator<Item = T>,
equality_comparer: impl Fn(&T, &T) -> bool,
)where
Self: ISourceCache<T, K>,
fn add_or_update_items_with_comparer(
&self,
items: impl IntoIterator<Item = T>,
equality_comparer: impl Fn(&T, &T) -> bool,
)where
Self: ISourceCache<T, K>,
add_or_update_items that leaves the equal items, by
equality_comparer, as they are (AddOrUpdate(IEnumerable<TObject>, IEqualityComparer<TObject>)).
Sourcefn clear(&self)where
Self: ISourceCache<T, K>,
fn clear(&self)where
Self: ISourceCache<T, K>,
Removes every item (Clear(ISourceCache)).
Sourcefn defer_until_loaded(&self) -> Rc<dyn IObservable<ChangeSet<T, K>>>
fn defer_until_loaded(&self) -> Rc<dyn IObservable<ChangeSet<T, K>>>
The items and their changes once the cache has items (DeferUntilLoaded(IObservableCache)).
Sourcefn edit_diff(
&self,
all_items: impl IntoIterator<Item = T>,
are_items_equal: impl Fn(&T, &T) -> bool,
)where
Self: ISourceCache<T, K>,
fn edit_diff(
&self,
all_items: impl IntoIterator<Item = T>,
are_items_equal: impl Fn(&T, &T) -> bool,
)where
Self: ISourceCache<T, K>,
Makes the cache hold all_items with the fewest changes: the items whose keys are gone
are removed, the new keys added, and the items that are_items_equal says differ updated
(EditDiff(IEnumerable<TObject>, Func<TObject, TObject, bool>) and
EditDiff(IEnumerable<TObject>, IEqualityComparer<TObject>)).
Sourcefn expire_after(
&self,
time_selector: impl Fn(&T) -> Option<Duration> + 'static,
) -> Rc<dyn IObservable<Vec<(K, T)>>>
fn expire_after( &self, time_selector: impl Fn(&T) -> Option<Duration> + 'static, ) -> Rc<dyn IObservable<Vec<(K, T)>>>
Removes each item from the cache once the time that time_selector gives for it has
passed (None: never), timed on the default scheduler; the removed items with their keys
(ExpireAfter(ISourceCache, Func<TObject, TimeSpan?>, TimeSpan? = null, IScheduler? = null)).
Sourcefn expire_after_on(
&self,
time_selector: impl Fn(&T) -> Option<Duration> + 'static,
scheduler: Rc<dyn IScheduler>,
) -> Rc<dyn IObservable<Vec<(K, T)>>>
fn expire_after_on( &self, time_selector: impl Fn(&T) -> Option<Duration> + 'static, scheduler: Rc<dyn IScheduler>, ) -> Rc<dyn IObservable<Vec<(K, T)>>>
expire_after on scheduler.
Sourcefn expire_after_with_polling(
&self,
time_selector: impl Fn(&T) -> Option<Duration> + 'static,
polling_interval: Option<Duration>,
) -> Rc<dyn IObservable<Vec<(K, T)>>>
fn expire_after_with_polling( &self, time_selector: impl Fn(&T) -> Option<Duration> + 'static, polling_interval: Option<Duration>, ) -> Rc<dyn IObservable<Vec<(K, T)>>>
expire_after that removes the expired items every
polling_interval rather than at their times.
Sourcefn expire_after_with_polling_on(
&self,
time_selector: impl Fn(&T) -> Option<Duration> + 'static,
polling_interval: Option<Duration>,
scheduler: Rc<dyn IScheduler>,
) -> Rc<dyn IObservable<Vec<(K, T)>>>
fn expire_after_with_polling_on( &self, time_selector: impl Fn(&T) -> Option<Duration> + 'static, polling_interval: Option<Duration>, scheduler: Rc<dyn IScheduler>, ) -> Rc<dyn IObservable<Vec<(K, T)>>>
expire_after_with_polling on scheduler.
Sourcefn limit_size_to(&self, size_limit: usize) -> Rc<dyn IObservable<Vec<(K, T)>>>
fn limit_size_to(&self, size_limit: usize) -> Rc<dyn IObservable<Vec<(K, T)>>>
Removes the oldest items of the cache beyond size_limit, on the default scheduler; the
removed items with their keys (LimitSizeTo(ISourceCache, int, IScheduler? = null)).
§Panics
For a size of zero (ArgumentException).
Sourcefn limit_size_to_on(
&self,
size_limit: usize,
scheduler: Rc<dyn IScheduler>,
) -> Rc<dyn IObservable<Vec<(K, T)>>>
fn limit_size_to_on( &self, size_limit: usize, scheduler: Rc<dyn IScheduler>, ) -> Rc<dyn IObservable<Vec<(K, T)>>>
limit_size_to on scheduler (LimitSizeTo(ISourceCache, int, IScheduler)).
Sourcefn populate_from(
&self,
observable: Rc<dyn IObservable<T>>,
) -> Rc<dyn IDisposable>
fn populate_from( &self, observable: Rc<dyn IObservable<T>>, ) -> Rc<dyn IDisposable>
Adds or updates each item of observable (PopulateFrom(IObservable<TObject>)).
Sourcefn populate_from_many<I: IntoIterator<Item = T> + 'static>(
&self,
observable: Rc<dyn IObservable<I>>,
) -> Rc<dyn IDisposable>
fn populate_from_many<I: IntoIterator<Item = T> + 'static>( &self, observable: Rc<dyn IObservable<I>>, ) -> Rc<dyn IDisposable>
Adds or updates the items of each collection of observable
(PopulateFrom(IObservable<IEnumerable<TObject>>)).
Sourcefn refresh(&self, item: &T)where
Self: ISourceCache<T, K>,
fn refresh(&self, item: &T)where
Self: ISourceCache<T, K>,
Signals that item has changed (Refresh(TObject)).
Sourcefn refresh_items(&self, items: impl IntoIterator<Item = T>)where
Self: ISourceCache<T, K>,
fn refresh_items(&self, items: impl IntoIterator<Item = T>)where
Self: ISourceCache<T, K>,
Signals that the items have changed (Refresh(IEnumerable<TObject>)).
Sourcefn refresh_all(&self)where
Self: ISourceCache<T, K>,
fn refresh_all(&self)where
Self: ISourceCache<T, K>,
Signals that every item has changed (Refresh()).
Sourcefn remove(&self, item: &T)where
Self: ISourceCache<T, K>,
fn remove(&self, item: &T)where
Self: ISourceCache<T, K>,
Removes the item of the key of item (Remove(TObject)).
Sourcefn remove_items(&self, items: impl IntoIterator<Item = T>)where
Self: ISourceCache<T, K>,
fn remove_items(&self, items: impl IntoIterator<Item = T>)where
Self: ISourceCache<T, K>,
Removes the items of the keys of items (Remove(IEnumerable<TObject>)).
Sourcefn remove_key(&self, key: K)where
Self: ISourceCache<T, K>,
fn remove_key(&self, key: K)where
Self: ISourceCache<T, K>,
Removes the item of key (RemoveKey(TKey), and Remove(TKey)).
Sourcefn remove_keys(&self, keys: impl IntoIterator<Item = K>)where
Self: ISourceCache<T, K>,
fn remove_keys(&self, keys: impl IntoIterator<Item = K>)where
Self: ISourceCache<T, K>,
Removes the items of keys (RemoveKeys(IEnumerable<TKey>), and
Remove(IEnumerable<TKey>)).
Sourcefn watch_value(&self, key: K) -> Rc<dyn IObservable<T>>
fn watch_value(&self, key: K) -> Rc<dyn IObservable<T>>
The item of key each time it changes (WatchValue(IObservableCache, TKey)).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".