Help with slice lifetime?


My code is at Would appreciate some help with the error message: cannot infer an appropriate lifetime for lifetime parameter in function call due to conflicting requirements.

Many thanks


line 32 can be

 pub fn next(&'a mut self) -> Option<Token<'a>> {

just as it says in the error. Half of learning rust is learning to read error messages. It takes some practise.

If this is next from Iter, than it is more complicated.


You can also elide the lifetimes from @Eh2406’s example, and write it like this (playpen):

pub fn next(&mut self) -> Option<Token>