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

pub fn take_till<I: Input, F>(i: I, f: F) -> SimpleResult<I, I::Buffer> where
    F: FnMut(I::Token) -> 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::prelude::{parse_only, take_till};

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

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