Function glue::combinators::matchers::is

source ยท
pub fn is<'a, Par>(parser: Par) -> impl Parser<'a, &'a str>
where Par: MatchParser,
Expand description

Match using a string or character literal, callback or implementation of MatchParser.

Can be used to match from a list of characters:

assert!(is(one_of("abcdef")).test("foobar"));
// Or:
assert!(is("abcdef".chars()).test("foobar"));

A function that takes a character as input:

assert!(is(alphabetic).test("foobar"));

A character literal:

assert!(is('f').test("foobar"));

A string literal:

assert_eq!(
    is("foobar").parse("foobar"),
    Ok((
        ParserContext {
            input: "foobar",
            bounds: 0..6,
        },
        "foobar"
    ))
);