Skip to content

Commit f5bd373

Browse files
committed
Improve docs for indexing / Dimension
1 parent 1120b56 commit f5bd373

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

src/dimension/dimension_trait.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ use super::conversion::Convert;
2626

2727
/// Array shape and index trait.
2828
///
29-
/// `unsafe` because of the assumptions in the default methods.
29+
/// This trait defines a number of methods and operations that can be used on
30+
/// dimensions and indices.
3031
///
31-
/// ***Don't implement this trait, it will evolve at will.***
32+
/// ***Note:*** *Don't implement this trait.*
3233
pub unsafe trait Dimension : Clone + Eq + Debug + Send + Sync + Default +
3334
IndexMut<usize, Output=usize> +
3435
Add<Self, Output=Self> +

src/lib.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,20 @@ pub type Ixs = isize;
285285
/// array[[1, 1]] = 7;
286286
/// ```
287287
///
288+
/// Important traits and types for dimension and indexing:
289+
///
290+
/// - A [`Dim`](Dim.t.html) value represents a dimensionality or index.
291+
/// - Trait [`Dimension`](Dimension.t.html) is implemented by all
292+
/// dimensionalities. It defines many operations for dimensions and indices.
293+
/// - Trait [`IntoDimension`](IntoDimension.t.html) is used to convert into a
294+
/// `Dim` value.
295+
/// - Trait [`ShapeBuilder`](ShapeBuilder.t.html) is an extension of
296+
/// `IntoDimension` and is used when constructing an array. A shape describes
297+
/// not just the extent of each axis but also their strides.
298+
/// - Trait [`NdIndex`](NdIndex.t.html) is an extension of `Dimension` and is
299+
/// for values that can be used with indexing syntax.
300+
///
301+
///
288302
/// The default memory order of an array is *row major* order (a.k.a “c” order),
289303
/// where each row is contiguous in memory.
290304
/// A *column major* (a.k.a. “f” or fortran) memory order array has

0 commit comments

Comments
 (0)