Macro nom::pair [−][src]
pair!(I -> IResult<I,O>, I -> IResult<I,P>) => I -> IResult<I, (O,P)>
pair returns a tuple of the results of its two child parsers of both succeed
named!(parser<&str, (&str, &str)>, pair!(alpha1, digit1)); assert_eq!(parser("abc123"), Ok(("", ("abc", "123")))); assert_eq!(parser("123abc"), Err(Err::Error(("123abc", ErrorKind::Alpha)))); assert_eq!(parser("abc;123"), Err(Err::Error((";123", ErrorKind::Digit))));