Macro 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

Example

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

 let a = b"abcdefgh";

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