@@ -96,10 +96,10 @@ pub trait Dimension:
9696 . try_fold ( 1_usize , |s, & a| s. checked_mul ( a) )
9797 }
9898
99- # [ doc ( hidden ) ]
99+ /// Returns the dimension as a slice of axis lengths.
100100 fn slice ( & self ) -> & [ Ix ] ;
101-
102- # [ doc ( hidden ) ]
101+
102+ /// Returns the dimension as a mutable slice of axis lengths.
103103 fn slice_mut ( & mut self ) -> & mut [ Ix ] ;
104104
105105 /// Borrow as a read-only array view.
@@ -114,7 +114,7 @@ pub trait Dimension:
114114 ArrayViewMut1 :: from ( self . slice_mut ( ) )
115115 }
116116
117- # [ doc ( hidden ) ]
117+ /// Returns `true` if the dimensions have equal axis lengths.
118118 fn equal ( & self , rhs : & Self ) -> bool
119119 {
120120 self . slice ( ) == rhs. slice ( )
@@ -124,7 +124,6 @@ pub trait Dimension:
124124 ///
125125 /// If the array is non-empty, the strides result in contiguous layout; if
126126 /// the array is empty, the strides are all zeros.
127- #[ doc( hidden) ]
128127 fn default_strides ( & self ) -> Self
129128 {
130129 // Compute default array strides
@@ -150,7 +149,6 @@ pub trait Dimension:
150149 ///
151150 /// If the array is non-empty, the strides result in contiguous layout; if
152151 /// the array is empty, the strides are all zeros.
153- #[ doc( hidden) ]
154152 fn fortran_strides ( & self ) -> Self
155153 {
156154 // Compute fortran array strides
@@ -180,7 +178,7 @@ pub trait Dimension:
180178 /// **Panics** if `Self` has a fixed size that is not `ndim`.
181179 fn zeros ( ndim : usize ) -> Self ;
182180
183- # [ doc ( hidden ) ]
181+ /// Returns the first valid index in the dimension, or `None` if any axis has length 0.
184182 #[ inline]
185183 fn first_index ( & self ) -> Option < Self >
186184 {
@@ -192,7 +190,6 @@ pub trait Dimension:
192190 Some ( Self :: zeros ( self . ndim ( ) ) )
193191 }
194192
195- #[ doc( hidden) ]
196193 /// Iteration -- Use self as size, and return next index after `index`
197194 /// or None if there are no more.
198195 // FIXME: use &Self for index or even &mut?
@@ -217,7 +214,6 @@ pub trait Dimension:
217214 }
218215 }
219216
220- #[ doc( hidden) ]
221217 /// Iteration -- Use self as size, and create the next index after `index`
222218 /// Return false if iteration is done
223219 ///
@@ -245,7 +241,6 @@ pub trait Dimension:
245241 /// strides are equal.
246242 ///
247243 /// Note: Returns `false` if any of the ndims don't match.
248- #[ doc( hidden) ]
249244 fn strides_equivalent < D > ( & self , strides1 : & Self , strides2 : & D ) -> bool
250245 where D : Dimension
251246 {
@@ -256,7 +251,6 @@ pub trait Dimension:
256251 . all ( |( & d, & s1, & s2) | d <= 1 || s1 as isize == s2 as isize )
257252 }
258253
259- #[ doc( hidden) ]
260254 /// Return stride offset for index.
261255 fn stride_offset ( index : & Self , strides : & Self ) -> isize
262256 {
@@ -267,14 +261,13 @@ pub trait Dimension:
267261 offset
268262 }
269263
270- #[ doc( hidden) ]
271264 /// Return stride offset for this dimension and index.
272265 fn stride_offset_checked ( & self , strides : & Self , index : & Self ) -> Option < isize >
273266 {
274267 stride_offset_checked ( self . slice ( ) , strides. slice ( ) , index. slice ( ) )
275268 }
276269
277- # [ doc ( hidden ) ]
270+ /// Returns the size of the last dimension axis, or 0 for scalar (zero-dimensional) arrays.
278271 fn last_elem ( & self ) -> usize
279272 {
280273 if self . ndim ( ) == 0 {
@@ -283,15 +276,16 @@ pub trait Dimension:
283276 self . slice ( ) [ self . ndim ( ) - 1 ]
284277 }
285278 }
286-
287- #[ doc( hidden) ]
279+ /// Sets the length of the last axis to `i`.
288280 fn set_last_elem ( & mut self , i : usize )
289281 {
290282 let nd = self . ndim ( ) ;
291283 self . slice_mut ( ) [ nd - 1 ] = i;
292284 }
293285
294- #[ doc( hidden) ]
286+ /// Returns `true` if the dimension and strides represent contiguous memory layout.
287+ ///
288+ /// Handles both standard (C-order) and reversed (negative stride) contiguous layouts.
295289 fn is_contiguous ( dim : & Self , strides : & Self ) -> bool
296290 {
297291 let defaults = dim. default_strides ( ) ;
@@ -324,7 +318,6 @@ pub trait Dimension:
324318 /// (in ascending order).
325319 ///
326320 /// Assumes that no stride value appears twice.
327- #[ doc( hidden) ]
328321 fn _fastest_varying_stride_order ( & self ) -> Self
329322 {
330323 let mut indices = self . clone ( ) ;
@@ -340,7 +333,6 @@ pub trait Dimension:
340333
341334 /// Compute the minimum stride axis (absolute value), under the constraint
342335 /// that the length of the axis is > 1;
343- #[ doc( hidden) ]
344336 fn min_stride_axis ( & self , strides : & Self ) -> Axis
345337 {
346338 let n = match self . ndim ( ) {
@@ -356,7 +348,6 @@ pub trait Dimension:
356348
357349 /// Compute the maximum stride axis (absolute value), under the constraint
358350 /// that the length of the axis is > 1;
359- #[ doc( hidden) ]
360351 fn max_stride_axis ( & self , strides : & Self ) -> Axis
361352 {
362353 match self . ndim ( ) {
@@ -376,7 +367,7 @@ pub trait Dimension:
376367 IxDyn ( self . slice ( ) )
377368 }
378369
379- # [ doc ( hidden ) ]
370+ /// Converts from another dimension type, returning `None` if `ndim` differs.
380371 fn from_dimension < D2 : Dimension > ( d : & D2 ) -> Option < Self >
381372 {
382373 let mut s = Self :: default ( ) ;
@@ -389,11 +380,11 @@ pub trait Dimension:
389380 None
390381 }
391382 }
392-
393- # [ doc ( hidden ) ]
383+
384+ /// Inserts a new axis of length 1 at the given position, increasing dimensionality.
394385 fn insert_axis ( & self , axis : Axis ) -> Self :: Larger ;
395386
396- # [ doc ( hidden ) ]
387+ /// Removes the specified axis, decreasing dimensionality. Panics if axis is invalid.
397388 fn try_remove_axis ( & self , axis : Axis ) -> Self :: Smaller ;
398389
399390 private_decl ! { }
0 commit comments