I’m trying to implement my own Iter struct with a Vec backing, and I’m having a terrible time trying to get lifetimes to behave properly. I’ve been studying the Iterator implementations in std, but I just can’t seem to figure out where I’m going wrong. I feel like I’ve tried everything under the sun.
Here’s a reduced case that should obviously fail to compile:
Any help is greatly appreciated.
To avoid the XY problem, my ultimate goal is to have the struct implement Iterator as well as a trait like Iterator, except that it steps backwards instead of forwards.