oni_comb_parser/combinator/
zip.rs1use crate::fail::PResult;
2use crate::input::Input;
3use crate::parser::Parser;
4
5pub struct Zip<P1, P2> {
6 pub(crate) first: P1,
7 pub(crate) second: P2,
8}
9
10impl<I, P1, P2> Parser<I> for Zip<P1, P2>
11where
12 I: Input,
13 P1: Parser<I>,
14 P2: Parser<I, Error = P1::Error>,
15{
16 type Error = P1::Error;
17 type Output = (P1::Output, P2::Output);
18
19 #[inline]
20 fn parse_next(&mut self, input: &mut I) -> PResult<Self::Output, Self::Error> {
21 let a = self.first.parse_next(input)?;
22 let b = self.second.parse_next(input)?;
23 Ok((a, b))
24 }
25}