pub type PerBufferCache<T> = Arc<ArcSwap<HashMap<BufferId, Arc<T>>>>;Expand description
Per-buffer cache slot — the canonical Slice 3b shape for per-buffer LSP feature data.
Use PerBufferCacheExt for the read / write / remove
helpers; the raw type exposes only what ArcSwap exposes.
Aliased Type§
pub struct PerBufferCache<T> { /* private fields */ }Trait Implementations§
Source§impl<T> PerBufferCacheExt<T> for PerBufferCache<T>
impl<T> PerBufferCacheExt<T> for PerBufferCache<T>
Source§fn get_for(&self, id: BufferId) -> Option<Arc<T>>
fn get_for(&self, id: BufferId) -> Option<Arc<T>>
Wait-free read: returns a detached
Arc<T> snapshot of
the cache entry for id, or None if no entry exists.
The returned Arc is independent of any subsequent
store; the renderer can hold it across the frame.Source§fn insert_for(&self, id: BufferId, value: T)
fn insert_for(&self, id: BufferId, value: T)
Store (or replace) the cache entry for
id. Copy-on-
write: clones the current HashMap, inserts, stores.Source§fn remove_for(&self, id: BufferId)
fn remove_for(&self, id: BufferId)
Remove the cache entry for
id if present. No-op when
the entry doesn’t exist. Copy-on-write semantics.Source§fn retain<F: FnMut(BufferId, &T) -> bool>(&self, predicate: F)
fn retain<F: FnMut(BufferId, &T) -> bool>(&self, predicate: F)
Retain only entries matching the predicate. Mirrors
HashMap::retain’s semantics: the predicate sees each
(BufferId, &T); entries returning false are dropped. Read moreSource§fn is_empty_snapshot(&self) -> bool
fn is_empty_snapshot(&self) -> bool
Returns
true when no entries exist. Wait-free.