Function chomp::parsers::take_till [] [src]

pub fn take_till<I: Copy, F>(i: Input<I>, f: F) -> SimpleResult<I, &[I]> where F: Fn(I) -> bool

Matches all items until f returns true, all items to that point will be returned as a slice upon success.

If no failure can be found the parser will be considered to be incomplete as there might be more input which needs to be matched.

use chomp::{Input, take_till};

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

assert_eq!(take_till(p, |c| c == b'd').unwrap(), b"abc");