nom::take!
[−]
[src]
macro_rules! take( ($i:expr, $count:expr) => ( { let cnt = $count as usize; if $i.len() < cnt { $crate::IResult::Incomplete($crate::Needed::Size(cnt)) } else { $crate::IResult::Done(&$i[cnt..],&$i[0..cnt]) } } ); );
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"[..]));