Trait ritecache::CountableMeter[][src]

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>; }
Expand description

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

Required methods

Add amount to current and return the sum.

Subtract amount from current and return the difference.

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.

Implementors