Struct CacheHitCounter
pub struct CacheHitCounter<C> { /* private fields */ }
Expand description
A wrapper around a SolverCache
that counts the number of cache hits and misses.
Implementations§
§impl<C> CacheHitCounter<C>
impl<C> CacheHitCounter<C>
pub fn new(inner: C) -> Self
pub fn new(inner: C) -> Self
Wraps inner
in a cache hit counter.
pub fn num_hits(&self) -> Arc<AtomicUsize>
pub fn num_hits(&self) -> Arc<AtomicUsize>
Returns a reference to the number of cache hits.
The referenced AtomicUsize
will update whenever a cache hit occurs.
This function only needs to be called once to obtain the reference.
pub fn num_misses(&self) -> Arc<AtomicUsize>
pub fn num_misses(&self) -> Arc<AtomicUsize>
Returns a reference to the number of cache misses.
The referenced AtomicUsize
will update whenever a cache miss occurs.
This function only needs to be called once to obtain the reference.
Trait Implementations§
§impl<C: SolverCache> SolverCache for CacheHitCounter<C>
impl<C: SolverCache> SolverCache for CacheHitCounter<C>
§fn get(&mut self, hash: &AssertionHash) -> Option<CacheResult>
fn get(&mut self, hash: &AssertionHash) -> Option<CacheResult>
Reads an entry from the solver cache.
§fn insert(&mut self, hash: AssertionHash, result: CacheResult)
fn insert(&mut self, hash: AssertionHash, result: CacheResult)
Inserts a new entry into the solver cache.
Auto Trait Implementations§
impl<C> Freeze for CacheHitCounter<C>where
C: Freeze,
impl<C> RefUnwindSafe for CacheHitCounter<C>where
C: RefUnwindSafe,
impl<C> Send for CacheHitCounter<C>where
C: Send,
impl<C> Sync for CacheHitCounter<C>where
C: Sync,
impl<C> Unpin for CacheHitCounter<C>where
C: Unpin,
impl<C> UnwindSafe for CacheHitCounter<C>where
C: UnwindSafe,
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
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more