[][src]Macro nom::peek

macro_rules! peek {
    ($i:expr, $submac:ident!( $($args:tt)* )) => { ... };
    ($i:expr, $f:expr) => { ... };
}

peek!(I -> IResult<I,O>) => I -> IResult<I, O> returns a result without consuming the input

the embedded parser may return Err(Err::Incomplete

 named!(ptag, peek!( tag!( "abcd" ) ) );

 let r = ptag(&b"abcdefgh"[..]);
 assert_eq!(r, Ok((&b"abcdefgh"[..], &b"abcd"[..])));