From 20844f1e9edfa91b40b0cf4bda7082b400c4f34d Mon Sep 17 00:00:00 2001 From: Jim Turner Date: Sat, 24 Sep 2022 18:27:18 -0400 Subject: [PATCH] Add slice_axis_move method --- src/impl_methods.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/impl_methods.rs b/src/impl_methods.rs index caeed2254..061e9e117 100644 --- a/src/impl_methods.rs +++ b/src/impl_methods.rs @@ -656,6 +656,16 @@ where debug_assert!(self.pointer_is_inbounds()); } + /// Slice the array in place along the specified axis, then return the sliced array. + /// + /// **Panics** if an index is out of bounds or step size is zero.
+ /// **Panics** if `axis` is out of bounds. + #[must_use = "slice_axis_move returns an array with the sliced result"] + pub fn slice_axis_move(mut self, axis: Axis, indices: Slice) -> Self { + self.slice_axis_inplace(axis, indices); + self + } + /// Return a view of a slice of the array, with a closure specifying the /// slice for each axis. ///