chasa 0.5.0

A parser combinator focused on rollback/commit, streaming inputs, and composable method chains.
Documentation
use crate::back::Back;

pub trait Counter<Item>: Back {
    type Pos: Ord + Clone;
    fn feed(&mut self, item: Item);
    fn pos(&self) -> Self::Pos;
}

impl<T> Counter<T> for usize {
    type Pos = usize;

    fn feed(&mut self, _item: T) {
        *self += 1;
    }

    fn pos(&self) -> Self::Pos {
        *self
    }
}