Trait sccache::lru_disk_cache::lru_cache::CountableMeter

source ·
pub trait CountableMeter<K, V>: Meter<K, V> {
    // Required methods
    fn add(
        &self,
        current: Self::Measure,
        amount: Self::Measure
    ) -> Self::Measure;
    fn sub(
        &self,
        current: Self::Measure,
        amount: Self::Measure
    ) -> Self::Measure;
    fn size(&self, current: Self::Measure) -> Option<u64>;
}
Expand description

A trait to allow the default Count measurement to not store an extraneous counter.

Required Methods§

source

fn add(&self, current: Self::Measure, amount: Self::Measure) -> Self::Measure

Add amount to current and return the sum.

source

fn sub(&self, current: Self::Measure, amount: Self::Measure) -> Self::Measure

Subtract amount from current and return the difference.

source

fn size(&self, current: Self::Measure) -> Option<u64>

Return current as a usize if possible, otherwise return None.

If this method returns None the cache will use the number of cache entries as its size.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<K, V, T> CountableMeter<K, V> for T
where T: CountableMeterWithMeasure<K, V, <T as Meter<K, V>>::Measure> + Meter<K, V>,

Count is all no-ops, the number of entries in the map is the size.