]> git.lizzy.rs Git - rust.git/commit
Auto merge of #37422 - bluss:wrapping-offset, r=alexcrichton
authorbors <bors@rust-lang.org>
Sat, 5 Nov 2016 00:48:07 +0000 (17:48 -0700)
committerGitHub <noreply@github.com>
Sat, 5 Nov 2016 00:48:07 +0000 (17:48 -0700)
commite96b9d2bb48b7a886a4d2b9df716265af5d15646
treeee3eff3c23fa1029bfa9e20a76ceb96f82e11406
parent713a360560ab70651d10f09c9949673fa5e42fcd
parent67626e0cc30e07fe8763d344e855d7b4750b0b33
Auto merge of #37422 - bluss:wrapping-offset, r=alexcrichton

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".