deimos-lang/dmc-lib/src/offset_counter.rs
2026-03-25 10:12:05 -05:00

24 lines
405 B
Rust

pub struct OffsetCounter {
counter: usize,
}
impl OffsetCounter {
pub fn new() -> Self {
Self { counter: 0 }
}
pub fn with_base(base: usize) -> Self {
Self { counter: base }
}
pub fn next(&mut self) -> usize {
let offset = self.counter;
self.counter += 1;
offset
}
pub fn get_count(&self) -> usize {
self.counter
}
}