nom::tuple
[−]
[src]
macro_rules! tuple { ($i:expr, $($rest:tt)*) => { ... }; }
tuple!(I->IResult<I,A>, I->IResult<I,B>, ... I->IResult<I,X>) => I -> IResult<I, (A, B, ..., X)>
chains parsers and assemble the sub results in a tuple.
The input type I
must implement nom::InputLength
.
This combinator will count how much data is consumed by every child parser and take it into account if there is not enough data
// the return type depends of the children parsers named!(parser<&[u8], (u16, &[u8], &[u8]) >, tuple!( be_u16 , take!(3), tag!("fg") ) ); assert_eq!( parser(&b"abcdefgh"[..]), Done( &b"h"[..], (0x6162u16, &b"cde"[..], &b"fg"[..]) ) );