use sliding_ring::{Direction, SlidingRing};
#[derive(Clone, Copy, Default)]
struct Bucket {
hits: u64,
}
fn main() {
const DEPTH: u8 = 64;
let mut ring = SlidingRing::<Bucket, DEPTH>::new(Bucket::default());
for step in 0..DEPTH {
ring.slot_mut(step).hits += 1;
}
let total: u64 = ring
.iter_from_anchor(Direction::Forward)
.map(|(_, bucket)| bucket.hits)
.sum();
println!("total hits: {}", total);
}