Skip to main content

CountableMeterWithMeasure

Trait CountableMeterWithMeasure 

Source
pub trait CountableMeterWithMeasure<K, V, M> {
    // Required methods
    fn meter_add(&self, current: M, amount: M) -> M;
    fn meter_sub(&self, current: M, amount: M) -> M;
    fn meter_size(&self, current: M) -> Option<u64>;
}

Required Methods§

Source

fn meter_add(&self, current: M, amount: M) -> M

Add amount to current and return the sum.

Source

fn meter_sub(&self, current: M, amount: M) -> M

Subtract amount from current and return the difference.

Source

fn meter_size(&self, current: M) -> 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.

Implementors§

Source§

impl<K, V> CountableMeterWithMeasure<K, V, ()> for Count

Source§

impl<K, V, T> CountableMeterWithMeasure<K, V, usize> for T
where T: Meter<K, V>,

For any other Meter with Measure=usize, just do the simple math.