ObservableCache
struct · ferroui-dynamic-data · v0.5.0
struct ObservableCache<T, K>
A cache whose edits and contents can be observed (ObservableCache<TObject, TKey>): the core
of SourceCache, and the cache of AsObservableCache.
Members
newwithout_key_selectorfrom_sourcekey_selectorupdate_from_sourceupdate_from_intermediatesuspend_countsuspend_notifications
new
fn new(key_selector: impl Fn(&T) -> K + 'static) -> Self
An empty cache whose items are keyed by key_selector
(ObservableCache(Func<TObject, TKey>)).
without_key_selector
fn without_key_selector() -> Self
A cache without a key selector, for edits that give the keys
(ObservableCache(Func<TObject, TKey>? = null)).
from_source
fn from_source<C: IChangeSet<T, K>>(source: Rc<dyn IObservable<C>>) -> Self
A cache that applies the change sets of source (ObservableCache(IObservable<IChangeSet>)).
key_selector
fn key_selector(self: &Self) -> Option<&KeySelector<T, K>>
The key selector of the cache.
update_from_source
fn update_from_source(self: &Self, update: impl FnOnce(&mut dyn ISourceUpdater<T, K>) -> ())
Runs an edit with the cache's key selector (UpdateFromSource); the changes are delivered
once the outermost edit ends.
update_from_intermediate
fn update_from_intermediate(self: &Self, update: impl FnOnce(&mut dyn ICacheUpdater<T, K>) -> ())
Runs an edit that gives the keys (UpdateFromIntermediate).
suspend_count
fn suspend_count(self: &Self) -> Rc<dyn IDisposable>
Holds back the notifications of count changes until the result is disposed
(SuspendCount).
suspend_notifications
fn suspend_notifications(self: &Self) -> Rc<dyn IDisposable>
Holds back the notifications of changes until the result is disposed; the changes made
meanwhile are delivered as one change set (SuspendNotifications).
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeSourceCacheEx<T, K>Borrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedCloneIConnectableCache<T, K>IObservableCache<T, K>IDisposableCacheChangeSetSource
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.