Implement DoubleEndedIterator for Items
This makes Items also implement DoubleEndedIterator, allowing traversal backwards from the end of the buffer.
Specifically, gapbuffer.iter().rev() should now work as expected.
I don't think this actually works, according to the Rust definition of DoubleEndedIterator. That is, I am pretty sure that both next() and next_back() are supposed to take from either end of the underlying data type (essentially, thing of it as a double ended queue). So there's no way to support this API with the current Items representation, which was why I removed it. Adding an extra length isn't a big deal though, I mostly didn't want to do it to keep the initial implementation simple.
I may have misunderstood the API then. So basically Items would need a idx_front and an idx_back, with next() advancing idx_front and next_back() rewinding idx_back?
Hm. Given that we can't really use slices normally here, we need some alternative way to start from some arbitrary point and iterate backwards. With a Vec, we could use v.slice_to(n).iter().rev(), but that doesn't really work here. Do we need an iter_from(isize)?
You could reimplement the Slice interface by declaring a new type that worked like a slice (i.e. takes a range, etc.).