pub fn take_fn<F, R, Input>(searcher: F) -> TakeFn<F, Input> where
    F: FnMut(Input::Range) -> R,
    R: Into<TakeRange>,
    Input: RangeStream,
    Input::Range: Range
Expand description

Searches the entire range using searcher and then consumes a range of Some(n). If f can not find anything in the range it must return None/NotFound which indicates an end of input error.

If partial parsing is used the TakeRange enum can be returned instead of Option. By returning TakeRange::NotFound(n) it indicates that the input can skip ahead until n when parsing is next resumed.

See take_until_bytes for a usecase.