Skip to content

Commit

Permalink
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
@@ -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 }
}
}

0 comments on commit 9ac07d7

Please sign in to comment.