algorithm 0.1.18

about algorithm data structure, now has ttl with lru/lru-k/lfu/arc and slab/rbtree/roaring_bitmap/timer_wheelss, 关于算法常用的数据结构
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use super::Timer;

pub struct StepTimer<T: Timer, V> {
    pub step: T,
    pub val: V,
}

impl<T: Timer, V> StepTimer<T, V> {
    pub fn new(val: V, step: T) -> Self {
        Self { val, step }
    }
}

impl<T: Timer, V> Timer for StepTimer<T, V> {
    fn when(&self) -> u64 {
        self.step.when()
    }
}