oni_comb_parser/
parser.rs1use alloc::boxed::Box;
2
3use crate::fail::PResult;
4use crate::input::Input;
5
6pub trait Parser<I: Input> {
7 type Output;
8 type Error;
9
10 fn parse_next(&mut self, input: &mut I) -> PResult<Self::Output, Self::Error>;
11}
12
13impl<I: Input, P: Parser<I> + ?Sized> Parser<I> for Box<P> {
14 type Error = P::Error;
15 type Output = P::Output;
16
17 #[inline]
18 fn parse_next(&mut self, input: &mut I) -> PResult<Self::Output, Self::Error> {
19 (**self).parse_next(input)
20 }
21}