[][src]Trait lru_disk_cache::lru_cache::CountableMeter

pub trait CountableMeter<K, V>: Meter<K, V> {
    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>; }

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

Required methods

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

Add amount to current and return the sum.

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

Subtract amount from current and return the difference.

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.

Loading content...

Implementors

impl<K, V, T: Meter<K, V>> CountableMeter<K, V> for T where
    T: CountableMeterWithMeasure<K, V, <T as Meter<K, V>>::Measure>, 
[src]

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

Loading content...