Macro nom::separated_pair [−][src]
separated_pair!(I -> IResult<I,O>, I -> IResult<I, T>, I -> IResult<I,P>) => I -> IResult<I, (O,P)>
separated_pair(X,sep,Y) returns a tuple of its first and third child parsers
if all 3 succeed
named!(parser<&str, (&str, &str)>, separated_pair!(alpha1, char!(','), digit1)); assert_eq!(parser("abc,123"), Ok(("", ("abc", "123")))); assert_eq!(parser("123,abc"), Err(Err::Error(("123,abc", ErrorKind::Alpha)))); assert_eq!(parser("abc;123"), Err(Err::Error((";123", ErrorKind::Char))));