Skip to content

Commit 319701d

Browse files
jturner314bluss
authored andcommitted
Expose MultiSlice trait in public API
This makes it visible in the docs, but the private marker trick prevents other crates from implementing it.
1 parent 5202a50 commit 319701d

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ pub use crate::dimension::IxDynImpl;
141141
pub use crate::dimension::NdIndex;
142142
pub use crate::error::{ErrorKind, ShapeError};
143143
pub use crate::indexes::{indices, indices_of};
144-
pub use crate::slice::{AxisSliceInfo, CanSlice, NewAxis, Slice, SliceArg, SliceInfo};
144+
pub use crate::slice::{AxisSliceInfo, CanSlice, MultiSlice, NewAxis, Slice, SliceArg, SliceInfo};
145145

146146
use crate::iterators::Baseiter;
147147
use crate::iterators::{ElementsBase, ElementsBaseMut, Iter, IterMut, Lanes};

src/slice.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -915,6 +915,8 @@ where
915915
/// **Panics** if performing any individual slice panics or if the slices
916916
/// are not disjoint (i.e. if they intersect).
917917
fn multi_slice_move(&self, view: ArrayViewMut<'a, A, D>) -> Self::Output;
918+
919+
private_decl! {}
918920
}
919921

920922
impl<'a, A, D> MultiSlice<'a, A, D> for ()
@@ -925,6 +927,8 @@ where
925927
type Output = ();
926928

927929
fn multi_slice_move(&self, _view: ArrayViewMut<'a, A, D>) -> Self::Output {}
930+
931+
private_impl! {}
928932
}
929933

930934
impl<'a, A, D, I0> MultiSlice<'a, A, D> for (&I0,)
@@ -938,6 +942,8 @@ where
938942
fn multi_slice_move(&self, view: ArrayViewMut<'a, A, D>) -> Self::Output {
939943
(view.slice_move(self.0),)
940944
}
945+
946+
private_impl! {}
941947
}
942948

943949
macro_rules! impl_multislice_tuple {
@@ -968,6 +974,8 @@ macro_rules! impl_multislice_tuple {
968974
)
969975
}
970976
}
977+
978+
private_impl! {}
971979
}
972980
};
973981
(@intersects_self $shape:expr, ($head:expr,)) => {
@@ -996,4 +1004,6 @@ where
9961004
fn multi_slice_move(&self, view: ArrayViewMut<'a, A, D>) -> Self::Output {
9971005
T::multi_slice_move(self, view)
9981006
}
1007+
1008+
private_impl! {}
9991009
}

0 commit comments

Comments
 (0)