Skip to content

Commit

Permalink
API: Change Slice::step_by step to be multiplicative (cumulative)
Browse files Browse the repository at this point in the history
  • Loading branch information
bluss committed Nov 28, 2017
1 parent 98c0878 commit 9ac07d7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
}
}

Expand Down

0 comments on commit 9ac07d7

Please sign in to comment.