winnow::combinator

Function eof

Source
pub fn eof<Input, Error>(
    input: &mut Input,
) -> Result<<Input as Stream>::Slice, Error>
where Input: Stream, Error: ParserError<Input>,
Expand description

Match the end of the Stream

Otherwise, it will error.

§Effective Signature

Assuming you are parsing a &str Stream:

pub fn eof<'i>(input: &mut &'i str) -> ModalResult<&'i str>

§Example


fn parser<'i>(input: &mut &'i str) -> ModalResult<&'i str> {
    eof.parse_next(input)
}
assert!(parser.parse_peek("abc").is_err());
assert_eq!(parser.parse_peek(""), Ok(("", "")));