pub fn either<A, B, I: Clone>(
    mut fst: impl Parser<A, I>,
    mut snd: impl Parser<B, I>,
) -> impl Parser<Either<A, B>, I> {
    move |input: I| {
        if let Some((a, input)) = fst.parse(input.clone()) {
            Some((Either::Left(a), input))
        } else if let Some((b, input)) = snd.parse(input) {
            Some((Either::Right(b), input))
        } else {
            None
        }
    }
}
/// Same as `either`, but allows for different output types for the parsers.
Same as `either`, but allows for different output types for the parsers.
Same as ` either ` but allows for different output types for the parsers .
pub fn either<A, B, I: Clone>(
    mut fst: impl Parser<A, I>,
    mut snd: impl Parser<B, I>,
) -> impl Parser<Either<A, B>, I> {
    move |input: I| {
        if let Some((a, input)) = fst.parse(input.clone()) {
            Some((Either::Left(a), input))
        } else if let Some((b, input)) = snd.parse(input) {
            Some((Either::Right(b), input))
        } else {
            None
        }
    }
}
pub fn either < A , B , I : Clone > ( mut fst : impl Parser < A , I > , mut snd : impl Parser < B , I > , ) -> impl Parser < Either < A , B > , I > { move | input : I | { if let Some ( ( a , input ) ) = fst . parse ( input . clone ( ) ) { Some ( ( Either :: Left ( a ) , input ) ) } else if let Some ( ( b , input ) ) = snd . parse ( input ) { Some ( ( Either :: Right ( b ) , input ) ) } else { None } } }
Same as `either`, but allows for different output types for the parsers.
Same as ` either ` but allows for different output types for the parsers .
fst
impl Parser<A, I>
snd
impl Parser<B, I>