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::{parse_only, take_till};

let r = parse_only(|i| take_till(i, |c| c == b'd'), b"abcdef");

assert_eq!(r, Ok(&b"abc"[..]));