source-stream-0.rs/src/pos/default_counters/index.rs

24 lines
398 B
Rust

use crate::pos::PosCounter;
pub struct IndexPosCounter {
index: usize,
}
impl Default for IndexPosCounter {
fn default() -> Self {
return IndexPosCounter { index: 0 };
}
}
impl<C: Copy> PosCounter<C> for IndexPosCounter {
type P = usize;
fn update(&mut self, _: C) {
self.index += 1;
}
fn export(&self) -> usize {
return self.index;
}
}