Implement Alt<I, O, E> for the 1-tuple type
This revision enables the use of the alt() combinator on a 1-tuple of
parsers. Notably, because only a single parser will need to see the
input, there is no Clone bound on this implementation, unlike with other
tuple sizes.
@@ -182,6 +182,15 @@ macro_rules! alt_trait_inner(
alt_trait!(A B C D E F G H I J K L M N O P Q R S T U);
+// Manually implement Alt for (A,), the 1-tuple type
+impl<Input, Output, Error: ParseError<Input>, A: Parser<Input, Output, Error>>
+ Alt<Input, Output, Error> for (A,)
+{
+ fn choice(&mut self, input: Input) -> IResult<Input, Output, Error> {
+ self.0.parse(input)
+ }
+}
+
macro_rules! permutation_trait(
(
$name1:ident $ty1:ident $item1:ident
