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::{Input, take};

let p = Input::new(b"abcd");

assert_eq!(take(p, 3).unwrap(), b"abc");