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