source-stream-0.rs/default-streams/src/pos/index.rs

24 lines
406 B
Rust

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