Function glue::combinators::finders::find_when_not

source ยท
pub fn find_when_not<'a, Pred, PredRes, Par, ParRes>(
    predicate: Pred,
    parser: Par,
) -> impl Parser<'a, ParRes>
where Pred: Parser<'a, PredRes>, Par: Parser<'a, ParRes>,
Expand description

Run a predicate, and if it is not successful, run another parser and return its results.

assert_eq!(
    find_when_not(is(digit), find_all((is('-'), is(digit)))).parse("-1"),
    Ok((
        ParserContext {
            input: "-1",
            bounds: 0..2,
        },
        ("-", "1")
    ))
);