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.
iter_over_range
method is provided.At one hand,
vec.iter_over_range(a..b)
is equivalent tovec.iter().skip(a).take(b - a)
. However, the latter requiresa
unnecessarynext
calls. Since all pinned vectors provide random access to elements, the objective ofiter_over_range
is to directly jump toa
and create an iterator from this point on, and hence, avoiding the unnecessary iterations at the beginning.