devela::_dep::winnow::combinator

Function eof

pub fn eof<Input, Error>(
    input: &mut Input,
) -> Result<<Input as Stream>::Slice, ErrMode<Error>> 
where Input: Stream, Error: ParserError<Input>,
Available on crate feature dep_winnow only.
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(("", "")));