nom::take [] [src]

macro_rules! take {
    ($i:expr, $count:expr) => { ... };
}

take!(nb) => &[T] -> IResult<&[T], &[T]> generates a parser consuming the specified number of bytes

 // Desmond parser
 named!(take5, take!( 5 ) );

 let a = b"abcdefgh";

 assert_eq!(take5(&a[..]), Done(&b"fgh"[..], &b"abcde"[..]));