though in my case I had a vec of &str or something like that.
What I do remember was the compiler sending me in circles. Honestly if it had just said something like "Hey dummy, you can't do that, go read the chapters on lifetimes again" I might have fixed it. But it kept telling me things like "Just add a lifetime specifier on this line" and I would do that and then get 2 more error messages. I think the errors sent me down the path of trying to do what the SO post mentions, which is
fn next<'a>(&'a mut self) -> Option<Vec<&'a T>>
instead of putting the lifetime on the impl block, which probably never even occurred to me was something you could do.
Ah ha, yes, this is more than just pointers. It's a "streaming" iterator as opposed to just an iterator, and yeah, we need more types, IIRC, before that's possible.
As I mentioned below, we love bugs about bad error messages, feel free to file them!
The idea here is to separate lifetime of iteration (the scope in which "next" is used 'i) and the lifetime of data ('a), which would result in following signature:
http://stackoverflow.com/questions/30422177/lifetime-in-iter...
though in my case I had a vec of &str or something like that.
What I do remember was the compiler sending me in circles. Honestly if it had just said something like "Hey dummy, you can't do that, go read the chapters on lifetimes again" I might have fixed it. But it kept telling me things like "Just add a lifetime specifier on this line" and I would do that and then get 2 more error messages. I think the errors sent me down the path of trying to do what the SO post mentions, which is
instead of putting the lifetime on the impl block, which probably never even occurred to me was something you could do.