pub struct Cache { /* private fields */ }Expand description
Shared cache of evaluated PortValues. Cloning a PortValue is
cheap (Arc-backed for the heavy variants) so cache reuse adds
near-zero overhead.
Implementations§
Source§impl Cache
impl Cache
pub fn new() -> Self
pub fn with_capacity(cap: usize) -> Self
Sourcepub fn get(&self, key: CacheKey) -> Option<PortValue>
pub fn get(&self, key: CacheKey) -> Option<PortValue>
Look up a cached value and refresh its LRU position.
pub fn insert(&self, key: CacheKey, value: PortValue)
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn clear(&self)
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Cache
impl RefUnwindSafe for Cache
impl Send for Cache
impl Sync for Cache
impl Unpin for Cache
impl UnsafeUnpin for Cache
impl UnwindSafe for Cache
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