Function chomp::parsers::take
[−]
[src]
pub fn take<I: Copy>(i: Input<I>, num: usize) -> SimpleResult<I, &[I]>
Matches num
items no matter what they are, returning a slice of the matched items.
If the buffer length is less than num
this parser is considered incomplete.
use chomp::{parse_only, take}; assert_eq!(parse_only(|i| take(i, 3), b"abcd"), Ok(&b"abc"[..]));