[−][src]Macro nom::tap
tap!(name: I -> IResult<I,O> => { block }) => I -> IResult<I, O>
allows access to the parser's result without affecting it
named!(ptag, tap!(res: tag!( "abcd" ) => { println!("recognized {}", str::from_utf8(res).unwrap()) } ) ); let r = ptag(&b"abcdefgh"[..]); assert_eq!(r, Ok((&b"efgh"[..], &b"abcd"[..])));