]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #37422 - bluss:wrapping-offset, r=alexcrichton
authorAlex Crichton <alex@alexcrichton.com>
Fri, 4 Nov 2016 23:49:29 +0000 (16:49 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Sat, 5 Nov 2016 17:50:22 +0000 (10:50 -0700)
Add .wrapping_offset() methods

.wrapping_offset() exposes the arith_offset intrinsic in the core
module (as methods on raw pointers, next to offset). This is the
first step in making it possible to stabilize the interface later.

`arith_offset` is a useful tool for developing iterators for two
reasons:
1. `arith_offset` is used by the slice's iterator, the most important
   iterator in libcore, and it is natural that Rust users need the same
   power available to implement similar iterators.
2. It is a good way to implement raw pointer iterations with step
   greater than one.

The name seems to fit the style of methods like "wrapping_add".


Trivial merge