diff --git a/src/data_traits.rs b/src/data_traits.rs index b117792c4..679f9c782 100644 --- a/src/data_traits.rs +++ b/src/data_traits.rs @@ -630,7 +630,6 @@ where } } - #[doc(hidden)] unsafe fn clone_from_with_ptr( &mut self, other: &Self, diff --git a/src/indexes.rs b/src/indexes.rs index 6f45fb3de..23ae2744c 100644 --- a/src/indexes.rs +++ b/src/indexes.rs @@ -180,22 +180,18 @@ impl NdProducer for Indices { private_impl! {} - #[doc(hidden)] fn raw_dim(&self) -> Self::Dim { self.dim } - #[doc(hidden)] fn equal_dim(&self, dim: &Self::Dim) -> bool { self.dim.equal(dim) } - #[doc(hidden)] fn as_ptr(&self) -> Self::Ptr { IndexPtr { index: self.start } } - #[doc(hidden)] fn layout(&self) -> Layout { if self.dim.ndim() <= 1 { Layout::one_dimensional() @@ -204,19 +200,16 @@ impl NdProducer for Indices { } } - #[doc(hidden)] unsafe fn as_ref(&self, ptr: Self::Ptr) -> Self::Item { ptr.index.into_pattern() } - #[doc(hidden)] unsafe fn uget_ptr(&self, i: &Self::Dim) -> Self::Ptr { let mut index = *i; index += &self.start; IndexPtr { index } } - #[doc(hidden)] fn stride_of(&self, axis: Axis) -> Self::Stride { axis.index() } @@ -226,7 +219,6 @@ impl NdProducer for Indices { 0 } - #[doc(hidden)] fn split_at(self, axis: Axis, index: usize) -> (Self, Self) { let start_a = self.start; let mut start_b = start_a; diff --git a/src/iterators/macros.rs b/src/iterators/macros.rs index d3a54453e..ff4b3bb93 100644 --- a/src/iterators/macros.rs +++ b/src/iterators/macros.rs @@ -63,42 +63,34 @@ impl<$($typarm)*> NdProducer for $fulltype { type Ptr = *mut A; type Stride = isize; - #[doc(hidden)] fn raw_dim(&self) -> D { self.$base.raw_dim() } - #[doc(hidden)] fn layout(&self) -> Layout { self.$base.layout() } - #[doc(hidden)] fn as_ptr(&self) -> *mut A { self.$base.as_ptr() as *mut _ } - #[doc(hidden)] fn contiguous_stride(&self) -> isize { self.$base.contiguous_stride() } - #[doc(hidden)] unsafe fn as_ref(&$self_, $ptr: *mut A) -> Self::Item { $refexpr } - #[doc(hidden)] unsafe fn uget_ptr(&self, i: &Self::Dim) -> *mut A { self.$base.uget_ptr(i) } - #[doc(hidden)] fn stride_of(&self, axis: Axis) -> isize { self.$base.stride_of(axis) } - #[doc(hidden)] fn split_at(self, axis: Axis, index: usize) -> (Self, Self) { let (a, b) = self.$base.split_at(axis, index); ($typename { @@ -114,6 +106,7 @@ impl<$($typarm)*> NdProducer for $fulltype { )* }) } + private_impl!{} } diff --git a/src/iterators/mod.rs b/src/iterators/mod.rs index b2e4b9c60..e660a55d0 100644 --- a/src/iterators/mod.rs +++ b/src/iterators/mod.rs @@ -1105,15 +1105,14 @@ impl<'a, A, D: Dimension> NdProducer for AxisIter<'a, A, D> { type Ptr = *mut A; type Stride = isize; - #[doc(hidden)] fn layout(&self) -> crate::Layout { crate::Layout::one_dimensional() } - #[doc(hidden)] + fn raw_dim(&self) -> Self::Dim { Ix1(self.len()) } - #[doc(hidden)] + fn as_ptr(&self) -> Self::Ptr { if self.len() > 0 { // `self.iter.index` is guaranteed to be in-bounds if any of the @@ -1131,7 +1130,6 @@ impl<'a, A, D: Dimension> NdProducer for AxisIter<'a, A, D> { self.iter.stride } - #[doc(hidden)] unsafe fn as_ref(&self, ptr: Self::Ptr) -> Self::Item { ArrayView::new_( ptr, @@ -1139,20 +1137,19 @@ impl<'a, A, D: Dimension> NdProducer for AxisIter<'a, A, D> { self.iter.inner_strides.clone(), ) } - #[doc(hidden)] + unsafe fn uget_ptr(&self, i: &Self::Dim) -> Self::Ptr { self.iter.offset(self.iter.index + i[0]) } - #[doc(hidden)] fn stride_of(&self, _axis: Axis) -> isize { self.contiguous_stride() } - #[doc(hidden)] fn split_at(self, _axis: Axis, index: usize) -> (Self, Self) { self.split_at(index) } + private_impl! {} } @@ -1162,15 +1159,14 @@ impl<'a, A, D: Dimension> NdProducer for AxisIterMut<'a, A, D> { type Ptr = *mut A; type Stride = isize; - #[doc(hidden)] fn layout(&self) -> crate::Layout { crate::Layout::one_dimensional() } - #[doc(hidden)] + fn raw_dim(&self) -> Self::Dim { Ix1(self.len()) } - #[doc(hidden)] + fn as_ptr(&self) -> Self::Ptr { if self.len() > 0 { // `self.iter.index` is guaranteed to be in-bounds if any of the @@ -1188,7 +1184,6 @@ impl<'a, A, D: Dimension> NdProducer for AxisIterMut<'a, A, D> { self.iter.stride } - #[doc(hidden)] unsafe fn as_ref(&self, ptr: Self::Ptr) -> Self::Item { ArrayViewMut::new_( ptr, @@ -1196,20 +1191,19 @@ impl<'a, A, D: Dimension> NdProducer for AxisIterMut<'a, A, D> { self.iter.inner_strides.clone(), ) } - #[doc(hidden)] + unsafe fn uget_ptr(&self, i: &Self::Dim) -> Self::Ptr { self.iter.offset(self.iter.index + i[0]) } - #[doc(hidden)] fn stride_of(&self, _axis: Axis) -> isize { self.contiguous_stride() } - #[doc(hidden)] fn split_at(self, _axis: Axis, index: usize) -> (Self, Self) { self.split_at(index) } + private_impl! {} } diff --git a/src/private.rs b/src/private.rs index 552b31497..1fa779ff0 100644 --- a/src/private.rs +++ b/src/private.rs @@ -11,13 +11,13 @@ macro_rules! private_decl { () => { /// This trait is private to implement; this method exists to make it /// impossible to implement outside the crate. + #[doc(hidden)] fn __private__(&self) -> crate::private::PrivateMarker; } } macro_rules! private_impl { () => { - #[doc(hidden)] fn __private__(&self) -> crate::private::PrivateMarker { crate::private::PrivateMarker } diff --git a/src/zip/ndproducer.rs b/src/zip/ndproducer.rs index 9829c6afc..0ddf33faf 100644 --- a/src/zip/ndproducer.rs +++ b/src/zip/ndproducer.rs @@ -214,37 +214,31 @@ impl<'a, A, D: Dimension> NdProducer for ArrayView<'a, A, D> { type Stride = isize; private_impl! {} - #[doc(hidden)] + fn raw_dim(&self) -> Self::Dim { self.raw_dim() } - #[doc(hidden)] fn equal_dim(&self, dim: &Self::Dim) -> bool { self.dim.equal(dim) } - #[doc(hidden)] fn as_ptr(&self) -> *mut A { self.as_ptr() as _ } - #[doc(hidden)] fn layout(&self) -> Layout { self.layout_impl() } - #[doc(hidden)] unsafe fn as_ref(&self, ptr: *mut A) -> Self::Item { &*ptr } - #[doc(hidden)] unsafe fn uget_ptr(&self, i: &Self::Dim) -> *mut A { self.ptr.as_ptr().offset(i.index_unchecked(&self.strides)) } - #[doc(hidden)] fn stride_of(&self, axis: Axis) -> isize { self.stride_of(axis) } @@ -254,7 +248,6 @@ impl<'a, A, D: Dimension> NdProducer for ArrayView<'a, A, D> { 1 } - #[doc(hidden)] fn split_at(self, axis: Axis, index: usize) -> (Self, Self) { self.split_at(axis, index) } @@ -267,37 +260,31 @@ impl<'a, A, D: Dimension> NdProducer for ArrayViewMut<'a, A, D> { type Stride = isize; private_impl! {} - #[doc(hidden)] + fn raw_dim(&self) -> Self::Dim { self.raw_dim() } - #[doc(hidden)] fn equal_dim(&self, dim: &Self::Dim) -> bool { self.dim.equal(dim) } - #[doc(hidden)] fn as_ptr(&self) -> *mut A { self.as_ptr() as _ } - #[doc(hidden)] fn layout(&self) -> Layout { self.layout_impl() } - #[doc(hidden)] unsafe fn as_ref(&self, ptr: *mut A) -> Self::Item { &mut *ptr } - #[doc(hidden)] unsafe fn uget_ptr(&self, i: &Self::Dim) -> *mut A { self.ptr.as_ptr().offset(i.index_unchecked(&self.strides)) } - #[doc(hidden)] fn stride_of(&self, axis: Axis) -> isize { self.stride_of(axis) } @@ -307,7 +294,6 @@ impl<'a, A, D: Dimension> NdProducer for ArrayViewMut<'a, A, D> { 1 } - #[doc(hidden)] fn split_at(self, axis: Axis, index: usize) -> (Self, Self) { self.split_at(axis, index) } @@ -320,37 +306,31 @@ impl NdProducer for RawArrayView { type Stride = isize; private_impl! {} - #[doc(hidden)] + fn raw_dim(&self) -> Self::Dim { self.raw_dim() } - #[doc(hidden)] fn equal_dim(&self, dim: &Self::Dim) -> bool { self.dim.equal(dim) } - #[doc(hidden)] fn as_ptr(&self) -> *const A { self.as_ptr() } - #[doc(hidden)] fn layout(&self) -> Layout { self.layout_impl() } - #[doc(hidden)] unsafe fn as_ref(&self, ptr: *const A) -> *const A { ptr } - #[doc(hidden)] unsafe fn uget_ptr(&self, i: &Self::Dim) -> *const A { self.ptr.as_ptr().offset(i.index_unchecked(&self.strides)) } - #[doc(hidden)] fn stride_of(&self, axis: Axis) -> isize { self.stride_of(axis) } @@ -360,7 +340,6 @@ impl NdProducer for RawArrayView { 1 } - #[doc(hidden)] fn split_at(self, axis: Axis, index: usize) -> (Self, Self) { self.split_at(axis, index) } @@ -373,37 +352,31 @@ impl NdProducer for RawArrayViewMut { type Stride = isize; private_impl! {} - #[doc(hidden)] + fn raw_dim(&self) -> Self::Dim { self.raw_dim() } - #[doc(hidden)] fn equal_dim(&self, dim: &Self::Dim) -> bool { self.dim.equal(dim) } - #[doc(hidden)] fn as_ptr(&self) -> *mut A { self.as_ptr() as _ } - #[doc(hidden)] fn layout(&self) -> Layout { self.layout_impl() } - #[doc(hidden)] unsafe fn as_ref(&self, ptr: *mut A) -> *mut A { ptr } - #[doc(hidden)] unsafe fn uget_ptr(&self, i: &Self::Dim) -> *mut A { self.ptr.as_ptr().offset(i.index_unchecked(&self.strides)) } - #[doc(hidden)] fn stride_of(&self, axis: Axis) -> isize { self.stride_of(axis) } @@ -413,7 +386,6 @@ impl NdProducer for RawArrayViewMut { 1 } - #[doc(hidden)] fn split_at(self, axis: Axis, index: usize) -> (Self, Self) { self.split_at(axis, index) }