pub fn tuple<I, O, E, List>(l: List) -> impl FnMut(I)where
E: ParseError<I>,
List: Tuple<I, O, E>,
Available on crate feature
mtls
only.Expand description
Applies a tuple of parsers one by one and returns their results as a tuple. There is a maximum of 21 parsers
use nom::sequence::tuple;
use nom::character::complete::{alpha1, digit1};
let mut parser = tuple((alpha1, digit1, alpha1));
assert_eq!(parser("abc123def"), Ok(("", ("abc", "123", "def"))));
assert_eq!(parser("123def"), Err(Err::Error(("123def", ErrorKind::Alpha))));