Function glue::combinators::matchers::eoi

source ยท
pub fn eoi<'a>() -> impl Parser<'a, &'a str>
Expand description

Match the end of input.

// Match the "foo" in "foo" or "foobar":
let mut parser = find_any((
    find_all((is("foo"), eoi())),
    find_all((is("foo"), empty())),
));

assert_eq!(
    parser.parse("foo"),
    Ok((
        ParserContext {
            input: "foo",
            bounds: 0..3,
        },
        ("foo", ""),
    ))
);
assert_eq!(
    parser.parse("foobar"),
    Ok((
        ParserContext {
            input: "foobar",
            bounds: 0..3,
        },
        ("foo", "")
    ))
);