Function combine::eof

source ·
pub fn eof<Input>() -> Eof<Input>
where Input: Stream,
Expand description

Succeeds only if the stream is at end of input, fails otherwise.

let mut parser = eof();
assert_eq!(parser.easy_parse(position::Stream::new("")), Ok(((), position::Stream::new(""))));
assert_eq!(parser.easy_parse(position::Stream::new("x")), Err(easy::Errors {
    position: SourcePosition::default(),
    errors: vec![
        easy::Error::Unexpected('x'.into()),
        easy::Error::Expected("end of input".into())
    ]
}));