Skip to main content

SourceCacheEx

Trait SourceCacheEx 

Source
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§

Source

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>)).

Source

fn add_or_update(&self, item: T)
where Self: ISourceCache<T, K>,

Adds item, or replaces the item of its key (AddOrUpdate(TObject)).

Source

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>)).

Source

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>)).

Source

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>)).

Source

fn clear(&self)
where Self: ISourceCache<T, K>,

Removes every item (Clear(ISourceCache)).

Source

fn defer_until_loaded(&self) -> Rc<dyn IObservable<ChangeSet<T, K>>>

The items and their changes once the cache has items (DeferUntilLoaded(IObservableCache)).

Source

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>)).

Source

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,

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)).

Source

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,

expire_after on scheduler.

Source

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,

expire_after that removes the expired items every polling_interval rather than at their times.

Source

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,

Source

fn limit_size_to(&self, size_limit: usize) -> Rc<dyn IObservable<Vec<(K, T)>>>
where Self: ISourceCache<T, K> + Clone + Sized + 'static,

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).

Source

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,

limit_size_to on scheduler (LimitSizeTo(ISourceCache, int, IScheduler)).

Source

fn populate_from( &self, observable: Rc<dyn IObservable<T>>, ) -> Rc<dyn IDisposable>
where Self: ISourceCache<T, K> + Clone + Sized + 'static,

Adds or updates each item of observable (PopulateFrom(IObservable<TObject>)).

Source

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,

Adds or updates the items of each collection of observable (PopulateFrom(IObservable<IEnumerable<TObject>>)).

Source

fn refresh(&self, item: &T)
where Self: ISourceCache<T, K>,

Signals that item has changed (Refresh(TObject)).

Source

fn refresh_items(&self, items: impl IntoIterator<Item = T>)
where Self: ISourceCache<T, K>,

Signals that the items have changed (Refresh(IEnumerable<TObject>)).

Source

fn refresh_all(&self)
where Self: ISourceCache<T, K>,

Signals that every item has changed (Refresh()).

Source

fn remove(&self, item: &T)
where Self: ISourceCache<T, K>,

Removes the item of the key of item (Remove(TObject)).

Source

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>)).

Source

fn remove_key(&self, key: K)
where Self: ISourceCache<T, K>,

Removes the item of key (RemoveKey(TKey), and Remove(TKey)).

Source

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>)).

Source

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".

Implementors§

Source§

impl<T: Clone + 'static, K: Eq + Hash + Clone + 'static, C: IObservableCache<T, K> + ?Sized> SourceCacheEx<T, K> for C