Skip to content

Commit 9ac07d7

Browse files
committed
API: Change Slice::step_by step to be multiplicative (cumulative)
1 parent 98c0878 commit 9ac07d7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/slice.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,15 @@ impl Slice {
5151
}
5252
}
5353

54-
/// Returns a new `Slice` with the given step size.
54+
/// Create a new `Slice` with the given step size (multiplied with the
55+
/// previous step size).
5556
///
5657
/// `step` must be nonzero.
5758
/// (This method checks with a debug assertion that `step` is not zero.)
5859
#[inline]
5960
pub fn step_by(self, step: isize) -> Self {
6061
debug_assert_ne!(step, 0, "Slice::step_by: step must be nonzero");
61-
Slice { step, ..self }
62+
Slice { step: self.step * step, ..self }
6263
}
6364
}
6465

0 commit comments

Comments
 (0)