Function combine::eof [] [src]

pub fn eof<I>() -> Eof<I> where
    I: Stream

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

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