Skip to content

Iterator over range

Latest
Compare
Choose a tag to compare
@orxfun orxfun released this 20 Sep 12:41
c432a4a

iter_over_range method is provided.

At one hand, vec.iter_over_range(a..b) is equivalent to vec.iter().skip(a).take(b - a). However, the latter requires a unnecessary next calls. Since all pinned vectors provide random access to elements, the objective of iter_over_range is to directly jump to a and create an iterator from this point on, and hence, avoiding the unnecessary iterations at the beginning.

Also

  • vec_range_limits helper method is also provided.