gapbuffer icon indicating copy to clipboard operation
gapbuffer copied to clipboard

Implement reversible "walk" iterator

Open crespyl opened this issue 10 years ago • 0 comments

See also #11. We may not need both this PR and #11, but with the lack of normal slicing behavior the usual DoubleEndedIterator approach to reverse iterators doesn't quite work. "Walk backwards from n" can't be implemented as buf.slice_to(n).iter().rev(), so this is a simple alternative. (buf.iter().skip(n).rev() also doesn't quite work, since that will have the iterator work from the end of the buffer to n, rather than n to start)

buf.walk_from(n).reverse()

crespyl avatar Jan 19 '15 17:01 crespyl