pub struct ChangeAwareCache<T, K> { /* private fields */ }Expand description
A keyed collection that records its changes until they are captured (ChangeAwareCache<TObject, TKey>): the building block of the cache operators.
Implementations§
Source§impl<T: Clone, K: Eq + Hash + Clone> ChangeAwareCache<T, K>
impl<T: Clone, K: Eq + Hash + Clone> ChangeAwareCache<T, K>
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
An empty cache with room for capacity items.
Sourcepub fn from_dictionary(data: Dictionary<K, T>) -> Self
pub fn from_dictionary(data: Dictionary<K, T>) -> Self
A cache of the items of data, without changes (ChangeAwareCache(Dictionary<TKey, TObject>)).
Sourcepub fn dictionary(&self) -> &Dictionary<K, T>
pub fn dictionary(&self) -> &Dictionary<K, T>
The underlying dictionary (GetDictionary).
Sourcepub fn into_dictionary(self) -> Dictionary<K, T>
pub fn into_dictionary(self) -> Dictionary<K, T>
The items, giving up the cache.
Sourcepub fn capture_changes(&mut self) -> ChangeSet<T, K>
pub fn capture_changes(&mut self) -> ChangeSet<T, K>
The changes since the last capture, and a clean slate (CaptureChanges).
Sourcepub fn has_changes(&self) -> bool
pub fn has_changes(&self) -> bool
Whether there are changes not captured yet.
Trait Implementations§
Source§impl<T: Clone, K: Eq + Hash + Clone> ICache<T, K> for ChangeAwareCache<T, K>
impl<T: Clone, K: Eq + Hash + Clone> ICache<T, K> for ChangeAwareCache<T, K>
Source§fn add_or_update(&mut self, item: T, key: K)
fn add_or_update(&mut self, item: T, key: K)
Adds the item, or replaces the item of its key (
AddOrUpdate(TObject, TKey)).Source§fn clone_changes(&mut self, changes: &ChangeSet<T, K>)
fn clone_changes(&mut self, changes: &ChangeSet<T, K>)
Applies a change set (
Clone(IChangeSet<TObject, TKey>)).Source§fn refresh_all(&mut self)
fn refresh_all(&mut self)
Refreshes every item (
Refresh()).Source§fn refresh_keys(&mut self, keys: &mut dyn Iterator<Item = K>)
fn refresh_keys(&mut self, keys: &mut dyn Iterator<Item = K>)
Refreshes the items of the keys (
Refresh(IEnumerable<TKey>)).Source§fn remove_keys(&mut self, keys: &mut dyn Iterator<Item = K>)
fn remove_keys(&mut self, keys: &mut dyn Iterator<Item = K>)
Removes the items of the keys (
Remove(IEnumerable<TKey>)).Auto Trait Implementations§
impl<T, K> Freeze for ChangeAwareCache<T, K>
impl<T, K> RefUnwindSafe for ChangeAwareCache<T, K>
impl<T, K> Send for ChangeAwareCache<T, K>
impl<T, K> Sync for ChangeAwareCache<T, K>
impl<T, K> Unpin for ChangeAwareCache<T, K>
impl<T, K> UnsafeUnpin for ChangeAwareCache<T, K>
impl<T, K> UnwindSafe for ChangeAwareCache<T, K>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more