From 9ac07d7b0db4a10cd4bc7a128dddbb23f0ff1565 Mon Sep 17 00:00:00 2001 From: bluss Date: Tue, 28 Nov 2017 20:29:18 +0100 Subject: [PATCH] API: Change Slice::step_by step to be multiplicative (cumulative) --- src/slice.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/slice.rs b/src/slice.rs index e8a394fb5..c3e8585a8 100644 --- a/src/slice.rs +++ b/src/slice.rs @@ -51,14 +51,15 @@ impl Slice { } } - /// Returns a new `Slice` with the given step size. + /// Create a new `Slice` with the given step size (multiplied with the + /// previous step size). /// /// `step` must be nonzero. /// (This method checks with a debug assertion that `step` is not zero.) #[inline] pub fn step_by(self, step: isize) -> Self { debug_assert_ne!(step, 0, "Slice::step_by: step must be nonzero"); - Slice { step, ..self } + Slice { step: self.step * step, ..self } } }