winnow::combinator

Function eof

Source
pub fn eof<Input, Error>(
    input: &mut Input,
) -> PResult<<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) -> PResult<&'i str>

§Example


let mut parser = eof;
assert_eq!(parser.parse_peek("abc"), Err(ErrMode::Backtrack(InputError::new("abc", ErrorKind::Eof))));
assert_eq!(parser.parse_peek(""), Ok(("", "")));