Function nom::sequence::tuple[][src]

pub fn tuple<I: Clone, O, E: ParseError<I>, List: Tuple<I, O, E>>(
    l: List
) -> impl Fn(I) -> IResult<I, O, E>

applies a tuple of parsers one by one and returns their results as a tuple

use nom::sequence::tuple;
use nom::character::complete::{alpha1, digit1};
let parser = tuple((alpha1, digit1, alpha1));

assert_eq!(parser("abc123def"), Ok(("", ("abc", "123", "def"))));
assert_eq!(parser("123def"), Err(Err::Error(("123def", ErrorKind::Alpha))));