Annotate struct
100 points
The starter code below does not compile. Fix errors and get it to compile.
Required signature
pub struct Parser<'a> { pub input: &'a str, pub position: usize, } impl<'a> Parser<'a> { pub fn new(input: &'a str) -> Parser<'a>; pub fn peek(&self) -> Option<&str>; }
Visible tests
-
peek_returns_remaining_slice#[test] fn peek_returns_remaining_slice() { let p = Parser::new("hello world"); assert_eq!(p.peek(), Some("hello world")); }
Your solution
Log in to submit a solution.