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.parse(State::new("")), Ok(((), State::new(""))));
assert_eq!(parser.parse(State::new("x")), Err(ParseError {
    position: <char as Positioner>::start(),
    errors: vec![
        Error::Unexpected('x'.into()),
        Error::Expected("end of input".into())
    ]
}));