From 1d5dfd15b5aac4e397dc962ae5e7459eb9d8c3d0 Mon Sep 17 00:00:00 2001 From: LeSeulArtichaut Date: Tue, 15 Jun 2021 12:15:04 +0200 Subject: [PATCH] Replace some links with intra-doc links --- ndarray-rand/src/lib.rs | 12 +- src/data_repr.rs | 2 +- src/dimension/dim.rs | 2 +- src/doc/ndarray_for_numpy_users/mod.rs | 177 ++++++++-------- src/doc/ndarray_for_numpy_users/rk_step.rs | 10 +- src/free_functions.rs | 2 +- src/impl_constructors.rs | 2 +- src/impl_cow.rs | 2 - src/impl_methods.rs | 12 +- src/impl_owned_array.rs | 6 - src/impl_special_element_types.rs | 2 - src/impl_views/conversions.rs | 6 - src/impl_views/indexing.rs | 18 +- src/impl_views/splitting.rs | 2 +- src/iterators/chunks.rs | 8 +- src/iterators/iter.rs | 2 +- src/iterators/lanes.rs | 4 +- src/iterators/mod.rs | 24 +-- src/iterators/windows.rs | 4 +- src/itertools.rs | 4 +- src/lib.rs | 234 ++++++++++----------- src/slice.rs | 25 +-- src/stacking.rs | 12 +- src/zip/mod.rs | 10 +- src/zip/ndproducer.rs | 6 +- src/zip/zipmacro.rs | 2 +- 26 files changed, 262 insertions(+), 328 deletions(-) diff --git a/ndarray-rand/src/lib.rs b/ndarray-rand/src/lib.rs index e293eb561..d9edabfdb 100644 --- a/ndarray-rand/src/lib.rs +++ b/ndarray-rand/src/lib.rs @@ -8,15 +8,15 @@ //! Constructors for randomized arrays: `rand` integration for `ndarray`. //! -//! See [**`RandomExt`**](trait.RandomExt.html) for usage examples. +//! See **[`RandomExt`]** for usage examples. //! //! ## Note //! //! `ndarray-rand` depends on [`rand` 0.8][rand]. //! //! [`rand`][rand] and [`rand_distr`][rand_distr] -//! are re-exported as sub-modules, [`ndarray_rand::rand`](rand/index.html) -//! and [`ndarray_rand::rand_distr`](rand_distr/index.html) respectively. +//! are re-exported as sub-modules, [`ndarray_rand::rand`](rand) +//! and [`ndarray_rand::rand_distr`](rand_distr) respectively. //! You can use these submodules for guaranteed version compatibility or //! convenience. //! @@ -60,7 +60,7 @@ pub mod rand_distr { /// Note that `SmallRng` is cheap to initialize and fast, but it may generate /// low-quality random numbers, and reproducibility is not guaranteed. See its /// documentation for information. You can select a different RNG with -/// [`.random_using()`](#tymethod.random_using). +/// [`.random_using()`](Self::random_using). pub trait RandomExt where S: RawData, @@ -293,8 +293,8 @@ where /// if lanes from the original array should only be sampled once (*without replacement*) or /// multiple times (*with replacement*). /// -/// [`sample_axis`]: trait.RandomExt.html#tymethod.sample_axis -/// [`sample_axis_using`]: trait.RandomExt.html#tymethod.sample_axis_using +/// [`sample_axis`]: RandomExt::sample_axis +/// [`sample_axis_using`]: RandomExt::sample_axis_using #[derive(Debug, Clone)] pub enum SamplingStrategy { WithReplacement, diff --git a/src/data_repr.rs b/src/data_repr.rs index 7047f2014..6630f9ddf 100644 --- a/src/data_repr.rs +++ b/src/data_repr.rs @@ -11,7 +11,7 @@ use rawpointer::PointerExt; /// Array's representation. /// /// *Don’t use this type directly—use the type alias -/// [`Array`](type.Array.html) for the array type!* +/// [`Array`](crate::Array) for the array type!* // Like a Vec, but with non-unique ownership semantics // // repr(C) to make it transmutable OwnedRepr -> OwnedRepr if diff --git a/src/dimension/dim.rs b/src/dimension/dim.rs index 97de6d842..19075f943 100644 --- a/src/dimension/dim.rs +++ b/src/dimension/dim.rs @@ -18,7 +18,7 @@ use crate::Ix; /// `Dim` describes the number of axes and the length of each axis /// in an array. It is also used as an index type. /// -/// See also the [`Dimension` trait](trait.Dimension.html) for its methods and +/// See also the [`Dimension`] trait for its methods and /// operations. /// /// # Examples diff --git a/src/doc/ndarray_for_numpy_users/mod.rs b/src/doc/ndarray_for_numpy_users/mod.rs index bedd1c8b5..f9c05c612 100644 --- a/src/doc/ndarray_for_numpy_users/mod.rs +++ b/src/doc/ndarray_for_numpy_users/mod.rs @@ -23,7 +23,7 @@ //! //! # Similarities //! -//! `ndarray`'s array type ([`ArrayBase`][ArrayBase]), is very similar to +//! `ndarray`'s array type ([`ArrayBase`]), is very similar to //! NumPy's array type (`numpy.ndarray`): //! //! * Arrays have a single element type. @@ -70,12 +70,12 @@ //! //! //! -//! In `ndarray`, all arrays are instances of [`ArrayBase`][ArrayBase], but -//! `ArrayBase` is generic over the ownership of the data. [`Array`][Array] -//! owns its data; [`ArrayView`][ArrayView] is a view; -//! [`ArrayViewMut`][ArrayViewMut] is a mutable view; [`CowArray`][CowArray] +//! In `ndarray`, all arrays are instances of [`ArrayBase`], but +//! `ArrayBase` is generic over the ownership of the data. [`Array`] +//! owns its data; [`ArrayView`] is a view; +//! [`ArrayViewMut`] is a mutable view; [`CowArray`] //! either owns its data or is a view (with copy-on-write mutation of the view -//! variant); and [`ArcArray`][ArcArray] has a reference-counted pointer to its +//! variant); and [`ArcArray`] has a reference-counted pointer to its //! data (with copy-on-write mutation). Arrays and views follow Rust's aliasing //! rules. //! @@ -91,7 +91,7 @@ //! //! //! In `ndarray`, you can create fixed-dimension arrays, such as -//! [`Array2`][Array2]. This takes advantage of the type system to help you +//! [`Array2`]. This takes advantage of the type system to help you //! write correct code and also avoids small heap allocations for the shape and //! strides. //! @@ -263,7 +263,7 @@ //! Note that [`a.shape()`][.shape()], [`a.dim()`][.dim()], and //! [`a.raw_dim()`][.raw_dim()] all return the shape of the array, but as //! different types. `a.shape()` returns the shape as `&[Ix]`, (where -//! [`Ix`][Ix] is `usize`) which is useful for general operations on the shape. +//! [`Ix`] is `usize`) which is useful for general operations on the shape. //! `a.dim()` returns the shape as `D::Pattern`, which is useful for //! pattern-matching shapes. `a.raw_dim()` returns the shape as `D`, which is //! useful for creating other arrays of the same shape. @@ -376,7 +376,7 @@ //! //! //! -//! [`a * b`, `a + b`, etc.](../../struct.ArrayBase.html#arithmetic-operations) +//! [`a * b`, `a + b`, etc.](ArrayBase#arithmetic-operations) //! //! //! @@ -540,17 +540,17 @@ //! ## Iteration //! //! `ndarray` has lots of interesting iterators/producers that implement the -//! [`NdProducer`][NdProducer] trait, which is a generalization of `Iterator` +//! [`NdProducer`](crate::NdProducer) trait, which is a generalization of `Iterator` //! to multiple dimensions. This makes it possible to correctly and efficiently //! zip together slices/subviews of arrays in multiple dimensions with -//! [`Zip`][Zip] or [`azip!()`][azip!]. The purpose of this is similar to +//! [`Zip`] or [`azip!()`]. The purpose of this is similar to //! [`np.nditer`](https://docs.scipy.org/doc/numpy/reference/generated/numpy.nditer.html), -//! but [`Zip`][Zip] is implemented and used somewhat differently. +//! but [`Zip`] is implemented and used somewhat differently. //! //! This table lists some of the iterators/producers which have a direct //! equivalent in NumPy. For a more complete introduction to producers and //! iterators, see [*Loops, Producers, and -//! Iterators*](../../struct.ArrayBase.html#loops-producers-and-iterators). +//! Iterators*](ArrayBase#loops-producers-and-iterators). //! Note that there are also variants of these iterators (with a `_mut` suffix) //! that yield `ArrayViewMut` instead of `ArrayView`. //! @@ -570,88 +570,77 @@ //! `a[:,4]` | [`a.column(4)`][.column()] or [`a.column_mut(4)`][.column_mut()] | view (or mutable view) of column 4 in a 2-D array //! `a.shape[0] == a.shape[1]` | [`a.is_square()`][.is_square()] | check if the array is square //! -//! [.abs_diff_eq()]: ../../struct.ArrayBase.html#impl-AbsDiffEq> -//! [ArcArray]: ../../type.ArcArray.html -//! [arr2()]: ../../fn.arr2.html -//! [array!]: ../../macro.array.html -//! [Array]: ../../type.Array.html -//! [Array2]: ../../type.Array2.html -//! [ArrayBase]: ../../struct.ArrayBase.html -//! [ArrayView]: ../../type.ArrayView.html -//! [ArrayViewMut]: ../../type.ArrayViewMut.html -//! [.assign()]: ../../struct.ArrayBase.html#method.assign -//! [.axis_iter()]: ../../struct.ArrayBase.html#method.axis_iter -//! [azip!]: ../../macro.azip.html -//! [.ncols()]: ../../struct.ArrayBase.html#method.ncols -//! [.column()]: ../../struct.ArrayBase.html#method.column -//! [.column_mut()]: ../../struct.ArrayBase.html#method.column_mut -//! [concatenate!]: ../../macro.concatenate.html -//! [concatenate()]: ../../fn.concatenate.html -//! [CowArray]: ../../type.CowArray.html -//! [::default()]: ../../struct.ArrayBase.html#method.default -//! [.diag()]: ../../struct.ArrayBase.html#method.diag -//! [.dim()]: ../../struct.ArrayBase.html#method.dim -//! [::eye()]: ../../struct.ArrayBase.html#method.eye -//! [.fill()]: ../../struct.ArrayBase.html#method.fill -//! [.fold()]: ../../struct.ArrayBase.html#method.fold -//! [.fold_axis()]: ../../struct.ArrayBase.html#method.fold_axis -//! [::from_elem()]: ../../struct.ArrayBase.html#method.from_elem -//! [::from_iter()]: ../../struct.ArrayBase.html#method.from_iter -//! [::from_diag()]: ../../struct.ArrayBase.html#method.from_diag -//! [::from_shape_fn()]: ../../struct.ArrayBase.html#method.from_shape_fn -//! [::from_shape_vec()]: ../../struct.ArrayBase.html#method.from_shape_vec -//! [::from_shape_vec_unchecked()]: ../../struct.ArrayBase.html#method.from_shape_vec_unchecked -//! [::from_vec()]: ../../struct.ArrayBase.html#method.from_vec -//! [.index()]: ../../struct.ArrayBase.html#impl-Index -//! [.indexed_iter()]: ../../struct.ArrayBase.html#method.indexed_iter -//! [.insert_axis()]: ../../struct.ArrayBase.html#method.insert_axis -//! [.is_empty()]: ../../struct.ArrayBase.html#method.is_empty -//! [.is_square()]: ../../struct.ArrayBase.html#method.is_square -//! [.iter()]: ../../struct.ArrayBase.html#method.iter -//! [Ix]: ../../type.Ix.html -//! [.len()]: ../../struct.ArrayBase.html#method.len -//! [.len_of()]: ../../struct.ArrayBase.html#method.len_of -//! [::linspace()]: ../../struct.ArrayBase.html#method.linspace -//! [::logspace()]: ../../struct.ArrayBase.html#method.logspace -//! [::geomspace()]: ../../struct.ArrayBase.html#method.geomspace -//! [.map()]: ../../struct.ArrayBase.html#method.map -//! [.map_axis()]: ../../struct.ArrayBase.html#method.map_axis -//! [.map_inplace()]: ../../struct.ArrayBase.html#method.map_inplace -//! [.mapv()]: ../../struct.ArrayBase.html#method.mapv -//! [.mapv_inplace()]: ../../struct.ArrayBase.html#method.mapv_inplace -//! [.mapv_into()]: ../../struct.ArrayBase.html#method.mapv_into -//! [matrix-* dot]: ../../struct.ArrayBase.html#method.dot-1 -//! [.mean()]: ../../struct.ArrayBase.html#method.mean -//! [.mean_axis()]: ../../struct.ArrayBase.html#method.mean_axis -//! [.ndim()]: ../../struct.ArrayBase.html#method.ndim -//! [NdProducer]: ../../trait.NdProducer.html -//! [::ones()]: ../../struct.ArrayBase.html#method.ones -//! [.outer_iter()]: ../../struct.ArrayBase.html#method.outer_iter -//! [::range()]: ../../struct.ArrayBase.html#method.range -//! [.raw_dim()]: ../../struct.ArrayBase.html#method.raw_dim -//! [.reversed_axes()]: ../../struct.ArrayBase.html#method.reversed_axes -//! [.row()]: ../../struct.ArrayBase.html#method.row -//! [.row_mut()]: ../../struct.ArrayBase.html#method.row_mut -//! [.nrows()]: ../../struct.ArrayBase.html#method.nrows -//! [s!]: ../../macro.s.html -//! [.sum()]: ../../struct.ArrayBase.html#method.sum -//! [.slice()]: ../../struct.ArrayBase.html#method.slice -//! [.slice_axis()]: ../../struct.ArrayBase.html#method.slice_axis -//! [.slice_collapse()]: ../../struct.ArrayBase.html#method.slice_collapse -//! [.slice_move()]: ../../struct.ArrayBase.html#method.slice_move -//! [.slice_mut()]: ../../struct.ArrayBase.html#method.slice_mut -//! [.shape()]: ../../struct.ArrayBase.html#method.shape -//! [stack!]: ../../macro.stack.html -//! [stack()]: ../../fn.stack.html -//! [.strides()]: ../../struct.ArrayBase.html#method.strides -//! [.index_axis()]: ../../struct.ArrayBase.html#method.index_axis -//! [.sum_axis()]: ../../struct.ArrayBase.html#method.sum_axis -//! [.t()]: ../../struct.ArrayBase.html#method.t -//! [vec-* dot]: ../../struct.ArrayBase.html#method.dot -//! [.for_each()]: ../../struct.ArrayBase.html#method.for_each -//! [::zeros()]: ../../struct.ArrayBase.html#method.zeros -//! [Zip]: ../../struct.Zip.html +//! [.abs_diff_eq()]: ArrayBase#impl-AbsDiffEq> +//! [.assign()]: ArrayBase::assign +//! [.axis_iter()]: ArrayBase::axis_iter +//! [.ncols()]: ArrayBase::ncols +//! [.column()]: ArrayBase::column +//! [.column_mut()]: ArrayBase::column_mut +//! [concatenate()]: crate::concatenate() +//! [::default()]: ArrayBase::default +//! [.diag()]: ArrayBase::diag +//! [.dim()]: ArrayBase::dim +//! [::eye()]: ArrayBase::eye +//! [.fill()]: ArrayBase::fill +//! [.fold()]: ArrayBase::fold +//! [.fold_axis()]: ArrayBase::fold_axis +//! [::from_elem()]: ArrayBase::from_elem +//! [::from_iter()]: ArrayBase::from_iter +//! [::from_diag()]: ArrayBase::from_diag +//! [::from_shape_fn()]: ArrayBase::from_shape_fn +//! [::from_shape_vec()]: ArrayBase::from_shape_vec +//! [::from_shape_vec_unchecked()]: ArrayBase::from_shape_vec_unchecked +//! [::from_vec()]: ArrayBase::from_vec +//! [.index()]: ArrayBase#impl-Index +//! [.indexed_iter()]: ArrayBase::indexed_iter +//! [.insert_axis()]: ArrayBase::insert_axis +//! [.is_empty()]: ArrayBase::is_empty +//! [.is_square()]: ArrayBase::is_square +//! [.iter()]: ArrayBase::iter +//! [.len()]: ArrayBase::len +//! [.len_of()]: ArrayBase::len_of +//! [::linspace()]: ArrayBase::linspace +//! [::logspace()]: ArrayBase::logspace +//! [::geomspace()]: ArrayBase::geomspace +//! [.map()]: ArrayBase::map +//! [.map_axis()]: ArrayBase::map_axis +//! [.map_inplace()]: ArrayBase::map_inplace +//! [.mapv()]: ArrayBase::mapv +//! [.mapv_inplace()]: ArrayBase::mapv_inplace +//! [.mapv_into()]: ArrayBase::mapv_into +//! [matrix-* dot]: ArrayBase::dot-1 +//! [.mean()]: ArrayBase::mean +//! [.mean_axis()]: ArrayBase::mean_axis +//! [.ndim()]: ArrayBase::ndim +//! [::ones()]: ArrayBase::ones +//! [.outer_iter()]: ArrayBase::outer_iter +//! [::range()]: ArrayBase::range +//! [.raw_dim()]: ArrayBase::raw_dim +//! [.reversed_axes()]: ArrayBase::reversed_axes +//! [.row()]: ArrayBase::row +//! [.row_mut()]: ArrayBase::row_mut +//! [.nrows()]: ArrayBase::nrows +//! [.sum()]: ArrayBase::sum +//! [.slice()]: ArrayBase::slice +//! [.slice_axis()]: ArrayBase::slice_axis +//! [.slice_collapse()]: ArrayBase::slice_collapse +//! [.slice_move()]: ArrayBase::slice_move +//! [.slice_mut()]: ArrayBase::slice_mut +//! [.shape()]: ArrayBase::shape +//! [stack()]: crate::stack() +//! [.strides()]: ArrayBase::strides +//! [.index_axis()]: ArrayBase::index_axis +//! [.sum_axis()]: ArrayBase::sum_axis +//! [.t()]: ArrayBase::t +//! [vec-* dot]: ArrayBase::dot +//! [.for_each()]: ArrayBase::for_each +//! [::zeros()]: ArrayBase::zeros +//! [`Zip`]: crate::Zip pub mod coord_transform; pub mod rk_step; pub mod simple_math; + +// This is to avoid putting `crate::` everywhere +#[allow(unused_imports)] +use crate::imp_prelude::*; diff --git a/src/doc/ndarray_for_numpy_users/rk_step.rs b/src/doc/ndarray_for_numpy_users/rk_step.rs index 92935f3e7..0448e0705 100644 --- a/src/doc/ndarray_for_numpy_users/rk_step.rs +++ b/src/doc/ndarray_for_numpy_users/rk_step.rs @@ -120,10 +120,10 @@ //! * Don't return a newly allocated `f_new` array. If the caller wants this //! information, they can get it from the last row of `k`. //! -//! * Use [`c.mul_add(h, t)`][f64.mul_add()] instead of `t + c * h`. This is +//! * Use [`c.mul_add(h, t)`](f64::mul_add) instead of `t + c * h`. This is //! faster and reduces the floating-point error. It might also be beneficial -//! to use [`.scaled_add()`][.scaled_add()] or a combination of -//! [`azip!()`][azip!] and [`.mul_add()`][f64.mul_add()] on the arrays in +//! to use [`.scaled_add()`] or a combination of +//! [`azip!()`] and [`.mul_add()`](f64::mul_add) on the arrays in //! some places, but that's not demonstrated in the example below. //! //! ``` @@ -168,9 +168,7 @@ //! # fn main() { let _ = rk_step::, ArrayViewMut1<'_, f64>)>; } //! ``` //! -//! [f64.mul_add()]: https://doc.rust-lang.org/std/primitive.f64.html#method.mul_add -//! [.scaled_add()]: ../../../struct.ArrayBase.html#method.scaled_add -//! [azip!]: ../../../macro.azip.html +//! [`.scaled_add()`]: crate::ArrayBase::scaled_add //! //! ### SciPy license //! diff --git a/src/free_functions.rs b/src/free_functions.rs index 95eb7dc81..fa85068b0 100644 --- a/src/free_functions.rs +++ b/src/free_functions.rs @@ -14,7 +14,7 @@ use alloc::vec::Vec; use crate::imp_prelude::*; use crate::{dimension, ArcArray1, ArcArray2}; -/// Create an [**`Array`**](type.Array.html) with one, two or +/// Create an **[`Array`]** with one, two or /// three dimensions. /// /// ``` diff --git a/src/impl_constructors.rs b/src/impl_constructors.rs index 46d0c76c5..5364417b0 100644 --- a/src/impl_constructors.rs +++ b/src/impl_constructors.rs @@ -269,7 +269,7 @@ macro_rules! size_of_shape_checked_unwrap { /// column major (“f” order) memory layout instead of the default row major. /// For example `Array::zeros((5, 6).f())` makes a column major 5 × 6 array. /// -/// Use [`IxDyn`](type.IxDyn.html) for the shape to create an array with dynamic +/// Use [`type@IxDyn`] for the shape to create an array with dynamic /// number of axes. /// /// Finally, the few constructors that take a completely general diff --git a/src/impl_cow.rs b/src/impl_cow.rs index b880fd62c..5cd00077e 100644 --- a/src/impl_cow.rs +++ b/src/impl_cow.rs @@ -11,8 +11,6 @@ use crate::imp_prelude::*; /// Methods specific to `CowArray`. /// /// ***See also all methods for [`ArrayBase`]*** -/// -/// [`ArrayBase`]: struct.ArrayBase.html impl<'a, A, D> CowArray<'a, A, D> where D: Dimension, diff --git a/src/impl_methods.rs b/src/impl_methods.rs index 51c1403a5..4e2122b05 100644 --- a/src/impl_methods.rs +++ b/src/impl_methods.rs @@ -179,7 +179,7 @@ where /// If the input array is contiguous, then the output array will have the same /// memory layout. Otherwise, the layout of the output array is unspecified. /// If you need a particular layout, you can allocate a new array with the - /// desired memory layout and [`.assign()`](#method.assign) the data. + /// desired memory layout and [`.assign()`](Self::assign) the data. /// Alternatively, you can collectan iterator, like this for a result in /// standard layout: /// @@ -400,7 +400,7 @@ where /// /// Iterator element type is `(D::Pattern, &A)`. /// - /// See also [`Zip::indexed`](struct.Zip.html) + /// See also [`Zip::indexed`] pub fn indexed_iter(&self) -> IndexedIter<'_, A, D> where S: Data, @@ -544,9 +544,9 @@ where /// collapsed, as in [`.collapse_axis()`], rather than removed, as in /// [`.slice_move()`] or [`.index_axis_move()`]. /// - /// [`.collapse_axis()`]: #method.collapse_axis - /// [`.slice_move()`]: #method.slice_move - /// [`.index_axis_move()`]: #method.index_axis_move + /// [`.collapse_axis()`]: Self::collapse_axis + /// [`.slice_move()`]: Self::slice_move + /// [`.index_axis_move()`]: Self::index_axis_move /// /// See [*Slicing*](#slicing) for full documentation. /// See also [`s!`], [`SliceArg`], and [`SliceInfo`](crate::SliceInfo). @@ -916,7 +916,7 @@ where /// Collapses the array to `index` along the axis and removes the axis. /// - /// See [`.index_axis()`](#method.index_axis) and [*Subviews*](#subviews) for full documentation. + /// See [`.index_axis()`](Self::index_axis) and [*Subviews*](#subviews) for full documentation. /// /// **Panics** if `axis` or `index` is out of bounds. pub fn index_axis_move(mut self, axis: Axis, index: usize) -> ArrayBase diff --git a/src/impl_owned_array.rs b/src/impl_owned_array.rs index efe67a046..e58932747 100644 --- a/src/impl_owned_array.rs +++ b/src/impl_owned_array.rs @@ -17,8 +17,6 @@ use crate::Zip; /// Methods specific to `Array0`. /// /// ***See also all methods for [`ArrayBase`]*** -/// -/// [`ArrayBase`]: struct.ArrayBase.html impl Array { /// Returns the single element in the array without cloning it. /// @@ -56,8 +54,6 @@ impl Array { /// Methods specific to `Array`. /// /// ***See also all methods for [`ArrayBase`]*** -/// -/// [`ArrayBase`]: struct.ArrayBase.html impl Array where D: Dimension, @@ -75,8 +71,6 @@ where /// Methods specific to `Array2`. /// /// ***See also all methods for [`ArrayBase`]*** -/// -/// [`ArrayBase`]: struct.ArrayBase.html impl Array { /// Append a row to an array /// diff --git a/src/impl_special_element_types.rs b/src/impl_special_element_types.rs index bf4384e42..5d5f18491 100644 --- a/src/impl_special_element_types.rs +++ b/src/impl_special_element_types.rs @@ -15,8 +15,6 @@ use crate::RawDataSubst; /// Methods specific to arrays with `MaybeUninit` elements. /// /// ***See also all methods for [`ArrayBase`]*** -/// -/// [`ArrayBase`]: struct.ArrayBase.html impl ArrayBase where S: RawDataSubst>, diff --git a/src/impl_views/conversions.rs b/src/impl_views/conversions.rs index d0f91b22b..7498add48 100644 --- a/src/impl_views/conversions.rs +++ b/src/impl_views/conversions.rs @@ -53,9 +53,6 @@ where /// Methods specific to `ArrayView0`. /// /// ***See also all methods for [`ArrayView`] and [`ArrayBase`]*** -/// -/// [`ArrayBase`]: struct.ArrayBase.html -/// [`ArrayView`]: struct.ArrayView.html impl<'a, A> ArrayView<'a, A, Ix0> { /// Consume the view and return a reference to the single element in the array. /// @@ -82,9 +79,6 @@ impl<'a, A> ArrayView<'a, A, Ix0> { /// Methods specific to `ArrayViewMut0`. /// /// ***See also all methods for [`ArrayViewMut`] and [`ArrayBase`]*** -/// -/// [`ArrayBase`]: struct.ArrayBase.html -/// [`ArrayViewMut`]: struct.ArrayViewMut.html impl<'a, A> ArrayViewMut<'a, A, Ix0> { /// Consume the mutable view and return a mutable reference to the single element in the array. /// diff --git a/src/impl_views/indexing.rs b/src/impl_views/indexing.rs index d8ed956f2..c73e870e6 100644 --- a/src/impl_views/indexing.rs +++ b/src/impl_views/indexing.rs @@ -59,7 +59,7 @@ pub trait IndexLonger { /// See also [the `get` method][1] which works for all arrays and array /// views. /// - /// [1]: struct.ArrayBase.html#method.get + /// [1]: ArrayBase::get /// /// **Panics** if index is out of bounds. fn index(self, index: I) -> Self::Output; @@ -73,8 +73,8 @@ pub trait IndexLonger { /// See also [the `get` method][1] (and [`get_mut`][2]) which works for all arrays and array /// views. /// - /// [1]: struct.ArrayBase.html#method.get - /// [2]: struct.ArrayBase.html#method.get_mut + /// [1]: ArrayBase::get + /// [2]: ArrayBase::get_mut /// /// **Panics** if index is out of bounds. fn get(self, index: I) -> Option; @@ -87,7 +87,7 @@ pub trait IndexLonger { /// See also [the `uget` method][1] which works for all arrays and array /// views. /// - /// [1]: struct.ArrayBase.html#method.uget + /// [1]: ArrayBase::uget /// /// **Note:** only unchecked for non-debug builds of ndarray. /// @@ -113,7 +113,7 @@ where /// See also [the `get` method][1] which works for all arrays and array /// views. /// - /// [1]: struct.ArrayBase.html#method.get + /// [1]: ArrayBase::get /// /// **Panics** if index is out of bounds. fn index(self, index: I) -> &'a A { @@ -133,7 +133,7 @@ where /// See also [the `uget` method][1] which works for all arrays and array /// views. /// - /// [1]: struct.ArrayBase.html#method.uget + /// [1]: ArrayBase::uget /// /// **Note:** only unchecked for non-debug builds of ndarray. unsafe fn uget(self, index: I) -> &'a A { @@ -158,7 +158,7 @@ where /// See also [the `get_mut` method][1] which works for all arrays and array /// views. /// - /// [1]: struct.ArrayBase.html#method.get_mut + /// [1]: ArrayBase::get_mut /// /// **Panics** if index is out of bounds. fn index(mut self, index: I) -> &'a mut A { @@ -177,7 +177,7 @@ where /// See also [the `get_mut` method][1] which works for all arrays and array /// views. /// - /// [1]: struct.ArrayBase.html#method.get_mut + /// [1]: ArrayBase::get_mut /// fn get(mut self, index: I) -> Option<&'a mut A> { debug_bounds_check!(self, index); @@ -195,7 +195,7 @@ where /// See also [the `uget_mut` method][1] which works for all arrays and array /// views. /// - /// [1]: struct.ArrayBase.html#method.uget_mut + /// [1]: ArrayBase::uget_mut /// /// **Note:** only unchecked for non-debug builds of ndarray. unsafe fn uget(mut self, index: I) -> &'a mut A { diff --git a/src/impl_views/splitting.rs b/src/impl_views/splitting.rs index a36ae4ddb..f2c0dc41a 100644 --- a/src/impl_views/splitting.rs +++ b/src/impl_views/splitting.rs @@ -121,7 +121,7 @@ where /// [`MultiSliceArg`], [`s!`], [`SliceArg`](crate::SliceArg), and /// [`SliceInfo`](crate::SliceInfo). /// - /// [`.multi_slice_mut()`]: struct.ArrayBase.html#method.multi_slice_mut + /// [`.multi_slice_mut()`]: ArrayBase::multi_slice_mut /// /// **Panics** if any of the following occur: /// diff --git a/src/iterators/chunks.rs b/src/iterators/chunks.rs index e41c1bf25..ba0e789fb 100644 --- a/src/iterators/chunks.rs +++ b/src/iterators/chunks.rs @@ -28,7 +28,7 @@ type BaseProducerMut<'a, A, D> = ArrayViewMut<'a, A, D>; /// Exact chunks producer and iterable. /// -/// See [`.exact_chunks()`](../struct.ArrayBase.html#method.exact_chunks) for more +/// See [`.exact_chunks()`](ArrayBase::exact_chunks) for more /// information. //#[derive(Debug)] pub struct ExactChunks<'a, A, D> { @@ -88,7 +88,7 @@ where /// Exact chunks iterator. /// -/// See [`.exact_chunks()`](../struct.ArrayBase.html#method.exact_chunks) for more +/// See [`.exact_chunks()`](ArrayBase::exact_chunks) for more /// information. pub struct ExactChunksIter<'a, A, D> { iter: ElementsBase<'a, A, D>, @@ -118,7 +118,7 @@ impl_ndproducer! { /// Exact chunks producer and iterable. /// -/// See [`.exact_chunks_mut()`](../struct.ArrayBase.html#method.exact_chunks_mut) +/// See [`.exact_chunks_mut()`](ArrayBase::exact_chunks_mut) /// for more information. //#[derive(Debug)] pub struct ExactChunksMut<'a, A, D> { @@ -222,7 +222,7 @@ impl_iterator! { /// Exact chunks iterator. /// -/// See [`.exact_chunks_mut()`](../struct.ArrayBase.html#method.exact_chunks_mut) +/// See [`.exact_chunks_mut()`](ArrayBase::exact_chunks_mut) /// for more information. pub struct ExactChunksIterMut<'a, A, D> { iter: ElementsBaseMut<'a, A, D>, diff --git a/src/iterators/iter.rs b/src/iterators/iter.rs index 7352e5e18..7b6d80cd5 100644 --- a/src/iterators/iter.rs +++ b/src/iterators/iter.rs @@ -4,7 +4,7 @@ //! implementation structs. //! //! -//! See also [`NdProducer`](../trait.NdProducer.html). +//! See also [`NdProducer`](crate::NdProducer). pub use crate::dimension::Axes; pub use crate::indexes::{Indices, IndicesIter}; diff --git a/src/iterators/lanes.rs b/src/iterators/lanes.rs index 2163c58a6..cda783a80 100644 --- a/src/iterators/lanes.rs +++ b/src/iterators/lanes.rs @@ -23,7 +23,7 @@ impl_ndproducer! { } } -/// See [`.lanes()`](../struct.ArrayBase.html#method.lanes) +/// See [`.lanes()`](ArrayBase::lanes) /// for more information. pub struct Lanes<'a, A, D> { base: ArrayView<'a, A, D>, @@ -92,7 +92,7 @@ where } } -/// See [`.lanes_mut()`](../struct.ArrayBase.html#method.lanes_mut) +/// See [`.lanes_mut()`](ArrayBase::lanes_mut) /// for more information. pub struct LanesMut<'a, A, D> { base: ArrayViewMut<'a, A, D>, diff --git a/src/iterators/mod.rs b/src/iterators/mod.rs index bb618e5be..2c6cc3e13 100644 --- a/src/iterators/mod.rs +++ b/src/iterators/mod.rs @@ -315,7 +315,7 @@ pub enum ElementsRepr { /// /// Iterator element type is `&'a A`. /// -/// See [`.iter()`](../struct.ArrayBase.html#method.iter) for more information. +/// See [`.iter()`](ArrayBase::iter) for more information. pub struct Iter<'a, A, D> { inner: ElementsRepr, ElementsBase<'a, A, D>>, } @@ -330,7 +330,7 @@ pub struct ElementsBase<'a, A, D> { /// /// Iterator element type is `&'a mut A`. /// -/// See [`.iter_mut()`](../struct.ArrayBase.html#method.iter_mut) for more information. +/// See [`.iter_mut()`](ArrayBase::iter_mut) for more information. pub struct IterMut<'a, A, D> { inner: ElementsRepr, ElementsBaseMut<'a, A, D>>, } @@ -354,12 +354,12 @@ impl<'a, A, D: Dimension> ElementsBaseMut<'a, A, D> { /// An iterator over the indexes and elements of an array. /// -/// See [`.indexed_iter()`](../struct.ArrayBase.html#method.indexed_iter) for more information. +/// See [`.indexed_iter()`](ArrayBase::indexed_iter) for more information. #[derive(Clone)] pub struct IndexedIter<'a, A, D>(ElementsBase<'a, A, D>); /// An iterator over the indexes and elements of an array (mutable). /// -/// See [`.indexed_iter_mut()`](../struct.ArrayBase.html#method.indexed_iter_mut) for more information. +/// See [`.indexed_iter_mut()`](ArrayBase::indexed_iter_mut) for more information. pub struct IndexedIterMut<'a, A, D>(ElementsBaseMut<'a, A, D>); impl<'a, A, D> IndexedIter<'a, A, D> @@ -681,7 +681,7 @@ where /// An iterator that traverses over all axes but one, and yields a view for /// each lane along that axis. /// -/// See [`.lanes()`](../struct.ArrayBase.html#method.lanes) for more information. +/// See [`.lanes()`](ArrayBase::lanes) for more information. pub struct LanesIter<'a, A, D> { inner_len: Ix, inner_stride: Ixs, @@ -732,7 +732,7 @@ where /// An iterator that traverses over all dimensions but the innermost, /// and yields each inner row (mutable). /// -/// See [`.lanes_mut()`](../struct.ArrayBase.html#method.lanes_mut) +/// See [`.lanes_mut()`](ArrayBase::lanes_mut) /// for more information. pub struct LanesIterMut<'a, A, D> { inner_len: Ix, @@ -927,8 +927,8 @@ where /// /// Iterator element type is `ArrayView<'a, A, D>`. /// -/// See [`.outer_iter()`](../struct.ArrayBase.html#method.outer_iter) -/// or [`.axis_iter()`](../struct.ArrayBase.html#method.axis_iter) +/// See [`.outer_iter()`](ArrayBase::outer_iter) +/// or [`.axis_iter()`](ArrayBase::axis_iter) /// for more information. #[derive(Debug)] pub struct AxisIter<'a, A, D> { @@ -1024,8 +1024,8 @@ where /// /// Iterator element type is `ArrayViewMut<'a, A, D>`. /// -/// See [`.outer_iter_mut()`](../struct.ArrayBase.html#method.outer_iter_mut) -/// or [`.axis_iter_mut()`](../struct.ArrayBase.html#method.axis_iter_mut) +/// See [`.outer_iter_mut()`](ArrayBase::outer_iter_mut) +/// or [`.axis_iter_mut()`](ArrayBase::axis_iter_mut) /// for more information. pub struct AxisIterMut<'a, A, D> { iter: AxisIterCore, @@ -1222,7 +1222,7 @@ impl<'a, A, D: Dimension> NdProducer for AxisIterMut<'a, A, D> { /// /// Iterator element type is `ArrayView<'a, A, D>`. /// -/// See [`.axis_chunks_iter()`](../struct.ArrayBase.html#method.axis_chunks_iter) for more information. +/// See [`.axis_chunks_iter()`](ArrayBase::axis_chunks_iter) for more information. pub struct AxisChunksIter<'a, A, D> { iter: AxisIterCore, /// Index of the partial chunk (the chunk smaller than the specified chunk @@ -1401,7 +1401,7 @@ macro_rules! chunk_iter_impl { /// /// Iterator element type is `ArrayViewMut<'a, A, D>`. /// -/// See [`.axis_chunks_iter_mut()`](../struct.ArrayBase.html#method.axis_chunks_iter_mut) +/// See [`.axis_chunks_iter_mut()`](ArrayBase::axis_chunks_iter_mut) /// for more information. pub struct AxisChunksIterMut<'a, A, D> { iter: AxisIterCore, diff --git a/src/iterators/windows.rs b/src/iterators/windows.rs index 4538f7abb..c47bfecec 100644 --- a/src/iterators/windows.rs +++ b/src/iterators/windows.rs @@ -6,7 +6,7 @@ use crate::NdProducer; /// Window producer and iterable /// -/// See [`.windows()`](../struct.ArrayBase.html#method.windows) for more +/// See [`.windows()`](ArrayBase::windows) for more /// information. pub struct Windows<'a, A, D> { base: ArrayView<'a, A, D>, @@ -86,7 +86,7 @@ where /// Window iterator. /// -/// See [`.windows()`](../struct.ArrayBase.html#method.windows) for more +/// See [`.windows()`](ArrayBase::windows) for more /// information. pub struct WindowsIter<'a, A, D> { iter: ElementsBase<'a, A, D>, diff --git a/src/itertools.rs b/src/itertools.rs index 96732f903..4fa8145ab 100644 --- a/src/itertools.rs +++ b/src/itertools.rs @@ -64,11 +64,9 @@ where /// The special cases of one and two arguments produce the equivalent of /// `$a.into_iter()` and `$a.into_iter().zip($b)` respectively. /// -/// Prefer this macro `izip!()` over [`multizip`] for the performance benefits +/// Prefer this macro `izip!()` over `multizip` for the performance benefits /// of using the standard library `.zip()`. /// -/// [`multizip`]: fn.multizip.html -/// /// ``` /// #[macro_use] extern crate itertools; /// # fn main() { diff --git a/src/lib.rs b/src/lib.rs index 8cf1a495f..fc6d4300b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -29,11 +29,11 @@ //! dimensions, then an element in the array is accessed by using that many indices. //! Each dimension is also called an *axis*. //! -//! - **[`ArrayBase`](struct.ArrayBase.html)**: +//! - **[`ArrayBase`]**: //! The *n*-dimensional array type itself.
//! It is used to implement both the owned arrays and the views; see its docs //! for an overview of all array features.
-//! - The main specific array type is **[`Array`](type.Array.html)**, which owns +//! - The main specific array type is **[`Array`]**, which owns //! its elements. //! //! ## Highlights @@ -45,8 +45,8 @@ //! - Higher order operations and arithmetic are performant //! - Array views can be used to slice and mutate any `[T]` data using //! `ArrayView::from` and `ArrayViewMut::from`. -//! - [`Zip`](struct.Zip.html) for lock step function application across two or more arrays or other -//! item producers ([`NdProducer`](trait.NdProducer.html) trait). +//! - [`Zip`] for lock step function application across two or more arrays or other +//! item producers ([`NdProducer`] trait). //! //! ## Crate Status //! @@ -99,13 +99,13 @@ //! //! ## Documentation //! -//! * The docs for [`ArrayBase`](struct.ArrayBase.html) provide an overview of +//! * The docs for [`ArrayBase`] provide an overview of //! the *n*-dimensional array type. Other good pages to look at are the -//! documentation for the [`s![]`](macro.s.html) and -//! [`azip!()`](macro.azip.html) macros. +//! documentation for the [`s![]`](s!) and +//! [`azip!()`](azip!) macros. //! //! * If you have experience with NumPy, you may also be interested in -//! [`ndarray_for_numpy_users`](doc/ndarray_for_numpy_users/index.html). +//! [`ndarray_for_numpy_users`](doc::ndarray_for_numpy_users). //! //! ## The ndarray ecosystem //! @@ -258,12 +258,6 @@ pub type Ixs = isize; /// [`ArrayViewMut`] refer to `ArrayBase` with different types for the data /// container. /// -/// [`Array`]: type.Array.html -/// [`ArcArray`]: type.ArcArray.html -/// [`ArrayView`]: type.ArrayView.html -/// [`ArrayViewMut`]: type.ArrayViewMut.html -/// [`CowArray`]: type.CowArray.html -/// /// ## Contents /// /// + [Array](#array) @@ -286,7 +280,7 @@ pub type Ixs = isize; /// /// ## `Array` /// -/// [`Array`](type.Array.html) is an owned array that owns the underlying array +/// [`Array`] is an owned array that owns the underlying array /// elements directly (just like a `Vec`) and it is the default way to create and /// store n-dimensional data. `Array` has two type parameters: `A` for /// the element type, and `D` for the dimensionality. A particular @@ -305,17 +299,16 @@ pub type Ixs = isize; /// /// ## `ArcArray` /// -/// [`ArcArray`](type.ArcArray.html) is an owned array with reference counted +/// [`ArcArray`] is an owned array with reference counted /// data (shared ownership). /// Sharing requires that it uses copy-on-write for mutable operations. /// Calling a method for mutating elements on `ArcArray`, for example -/// [`view_mut()`](#method.view_mut) or [`get_mut()`](#method.get_mut), +/// [`view_mut()`](Self::view_mut) or [`get_mut()`](Self::get_mut), /// will break sharing and require a clone of the data (if it is not uniquely held). /// /// ## `CowArray` /// -/// [`CowArray`](type.CowArray.html) is analogous to -/// [`std::borrow::Cow`](https://doc.rust-lang.org/std/borrow/enum.Cow.html). +/// [`CowArray`] is analogous to [`std::borrow::Cow`]. /// It can represent either an immutable view or a uniquely owned array. If a /// `CowArray` instance is the immutable view variant, then calling a method /// for mutating elements in the array will cause it to be converted into the @@ -380,15 +373,15 @@ pub type Ixs = isize; /// /// Important traits and types for dimension and indexing: /// -/// - A [`Dim`](struct.Dim.html) value represents a dimensionality or index. -/// - Trait [`Dimension`](trait.Dimension.html) is implemented by all +/// - A [`struct@Dim`] value represents a dimensionality or index. +/// - Trait [`Dimension`] is implemented by all /// dimensionalities. It defines many operations for dimensions and indices. -/// - Trait [`IntoDimension`](trait.IntoDimension.html) is used to convert into a +/// - Trait [`IntoDimension`] is used to convert into a /// `Dim` value. -/// - Trait [`ShapeBuilder`](trait.ShapeBuilder.html) is an extension of +/// - Trait [`ShapeBuilder`] is an extension of /// `IntoDimension` and is used when constructing an array. A shape describes /// not just the extent of each axis but also their strides. -/// - Trait [`NdIndex`](trait.NdIndex.html) is an extension of `Dimension` and is +/// - Trait [`NdIndex`] is an extension of `Dimension` and is /// for values that can be used with indexing syntax. /// /// @@ -403,10 +396,10 @@ pub type Ixs = isize; /// /// ## Loops, Producers and Iterators /// -/// Using [`Zip`](struct.Zip.html) is the most general way to apply a procedure +/// Using [`Zip`] is the most general way to apply a procedure /// across one or several arrays or *producers*. /// -/// [`NdProducer`](trait.NdProducer.html) is like an iterable but for +/// [`NdProducer`] is like an iterable but for /// multidimensional data. All producers have dimensions and axes, like an /// array view, and they can be split and used with parallelization using `Zip`. /// @@ -478,12 +471,12 @@ pub type Ixs = isize; /// [`.columns()`][gc], [`.columns_mut()`][gcm], /// [`.lanes(axis)`][l], [`.lanes_mut(axis)`][lm]. /// -/// [gr]: #method.rows -/// [grm]: #method.rows_mut -/// [gc]: #method.columns -/// [gcm]: #method.columns_mut -/// [l]: #method.lanes -/// [lm]: #method.lanes_mut +/// [gr]: Self::rows +/// [grm]: Self::rows_mut +/// [gc]: Self::columns +/// [gcm]: Self::columns_mut +/// [l]: Self::lanes +/// [lm]: Self::lanes_mut /// /// Yes, for 2D arrays `.rows()` and `.outer_iter()` have about the same /// effect: @@ -497,7 +490,7 @@ pub type Ixs = isize; /// the array. Slicing methods include [`.slice()`], [`.slice_mut()`], /// [`.slice_move()`], and [`.slice_collapse()`]. /// -/// The slicing argument can be passed using the macro [`s![]`](macro.s!.html), +/// The slicing argument can be passed using the macro [`s![]`](s!), /// which will be used in all examples. (The explicit form is an instance of /// [`SliceInfo`] or another type which implements [`SliceArg`]; see their docs /// for more information.) @@ -509,11 +502,10 @@ pub type Ixs = isize; /// [`.slice_collapse()`] panics on `NewAxis` elements and behaves like /// [`.collapse_axis()`] by preserving the number of dimensions. /// -/// [`.slice()`]: #method.slice -/// [`.slice_mut()`]: #method.slice_mut -/// [`.slice_move()`]: #method.slice_move -/// [`.slice_collapse()`]: #method.slice_collapse -/// [`NewAxis`]: struct.NewAxis.html +/// [`.slice()`]: Self::slice +/// [`.slice_mut()`]: Self::slice_mut +/// [`.slice_move()`]: Self::slice_move +/// [`.slice_collapse()`]: Self::slice_collapse /// /// When slicing arrays with generic dimensionality, creating an instance of /// [`SliceInfo`] to pass to the multi-axis slicing methods like [`.slice()`] @@ -522,18 +514,18 @@ pub type Ixs = isize; /// or to create a view and then slice individual axes of the view using /// methods such as [`.slice_axis_inplace()`] and [`.collapse_axis()`]. /// -/// [`.slice_each_axis()`]: #method.slice_each_axis -/// [`.slice_each_axis_mut()`]: #method.slice_each_axis_mut -/// [`.slice_each_axis_inplace()`]: #method.slice_each_axis_inplace -/// [`.slice_axis_inplace()`]: #method.slice_axis_inplace -/// [`.collapse_axis()`]: #method.collapse_axis +/// [`.slice_each_axis()`]: Self::slice_each_axis +/// [`.slice_each_axis_mut()`]: Self::slice_each_axis_mut +/// [`.slice_each_axis_inplace()`]: Self::slice_each_axis_inplace +/// [`.slice_axis_inplace()`]: Self::slice_axis_inplace +/// [`.collapse_axis()`]: Self::collapse_axis /// /// It's possible to take multiple simultaneous *mutable* slices with /// [`.multi_slice_mut()`] or (for [`ArrayViewMut`] only) /// [`.multi_slice_move()`]. /// -/// [`.multi_slice_mut()`]: #method.multi_slice_mut -/// [`.multi_slice_move()`]: type.ArrayViewMut.html#method.multi_slice_move +/// [`.multi_slice_mut()`]: Self::multi_slice_mut +/// [`.multi_slice_move()`]: ArrayViewMut#method.multi_slice_move /// /// ``` /// use ndarray::{arr2, arr3, s, ArrayBase, DataMut, Dimension, NewAxis, Slice}; @@ -631,16 +623,16 @@ pub type Ixs = isize; /// Methods for selecting an individual subview take two arguments: `axis` and /// `index`. /// -/// [`.axis_iter()`]: #method.axis_iter -/// [`.axis_iter_mut()`]: #method.axis_iter_mut -/// [`.fold_axis()`]: #method.fold_axis -/// [`.index_axis()`]: #method.index_axis -/// [`.index_axis_inplace()`]: #method.index_axis_inplace -/// [`.index_axis_mut()`]: #method.index_axis_mut -/// [`.index_axis_move()`]: #method.index_axis_move -/// [`.collapse_axis()`]: #method.collapse_axis -/// [`.outer_iter()`]: #method.outer_iter -/// [`.outer_iter_mut()`]: #method.outer_iter_mut +/// [`.axis_iter()`]: Self::axis_iter +/// [`.axis_iter_mut()`]: Self::axis_iter_mut +/// [`.fold_axis()`]: Self::fold_axis +/// [`.index_axis()`]: Self::index_axis +/// [`.index_axis_inplace()`]: Self::index_axis_inplace +/// [`.index_axis_mut()`]: Self::index_axis_mut +/// [`.index_axis_move()`]: Self::index_axis_move +/// [`.collapse_axis()`]: Self::collapse_axis +/// [`.outer_iter()`]: Self::outer_iter +/// [`.outer_iter_mut()`]: Self::outer_iter_mut /// /// ``` /// @@ -723,7 +715,7 @@ pub type Ixs = isize; /// /// ### Binary Operators with Array and Scalar /// -/// The trait [`ScalarOperand`](trait.ScalarOperand.html) marks types that can be used in arithmetic +/// The trait [`ScalarOperand`] marks types that can be used in arithmetic /// with arrays directly. For a scalar `K` the following combinations of operands /// are supported (scalar can be on either the left or right side, but /// `ScalarOperand` docs has the detailed condtions). @@ -746,7 +738,7 @@ pub type Ixs = isize; /// Arrays support limited *broadcasting*, where arithmetic operations with /// array operands of different sizes can be carried out by repeating the /// elements of the smaller dimension array. See -/// [`.broadcast()`](#method.broadcast) for a more detailed +/// [`.broadcast()`](Self::broadcast) for a more detailed /// description. /// /// ``` @@ -892,12 +884,12 @@ pub type Ixs = isize; /// /// /// -/// [`CowArray::from(a)`](type.CowArray.html#impl-From%2C%20D>>) +/// [`CowArray::from(a)`](CowArray#impl-From%2C%20D>>) /// /// /// /// -/// [`CowArray::from(a.into_owned())`](type.CowArray.html#impl-From%2C%20D>>) +/// [`CowArray::from(a.into_owned())`](CowArray#impl-From%2C%20D>>) /// /// /// @@ -907,12 +899,12 @@ pub type Ixs = isize; /// /// /// -/// [`CowArray::from(a)`](type.CowArray.html#impl-From%2C%20D>>) +/// [`CowArray::from(a)`](CowArray#impl-From%2C%20D>>) /// /// /// /// -/// [`CowArray::from(a.view())`](type.CowArray.html#impl-From%2C%20D>>) +/// [`CowArray::from(a.view())`](CowArray#impl-From%2C%20D>>) /// /// /// @@ -1041,19 +1033,19 @@ pub type Ixs = isize; /// /// Input | Output | Methods /// ------|--------|-------- -/// `Vec
` | `ArrayBase` | [`::from_vec()`](#method.from_vec) -/// `Vec` | `ArrayBase` | [`::from_shape_vec()`](#method.from_shape_vec) -/// `&[A]` | `ArrayView1` | [`::from()`](type.ArrayView.html#method.from) -/// `&[A]` | `ArrayView` | [`::from_shape()`](type.ArrayView.html#method.from_shape) -/// `&mut [A]` | `ArrayViewMut1` | [`::from()`](type.ArrayViewMut.html#method.from) -/// `&mut [A]` | `ArrayViewMut` | [`::from_shape()`](type.ArrayViewMut.html#method.from_shape) -/// `&ArrayBase` | `Vec` | [`.to_vec()`](#method.to_vec) -/// `Array` | `Vec` | [`.into_raw_vec()`](type.Array.html#method.into_raw_vec)[1](#into_raw_vec) -/// `&ArrayBase` | `&[A]` | [`.as_slice()`](#method.as_slice)[2](#req_contig_std), [`.as_slice_memory_order()`](#method.as_slice_memory_order)[3](#req_contig) -/// `&mut ArrayBase` | `&mut [A]` | [`.as_slice_mut()`](#method.as_slice_mut)[2](#req_contig_std), [`.as_slice_memory_order_mut()`](#method.as_slice_memory_order_mut)[3](#req_contig) -/// `ArrayView` | `&[A]` | [`.to_slice()`](type.ArrayView.html#method.to_slice)[2](#req_contig_std) -/// `ArrayViewMut` | `&mut [A]` | [`.into_slice()`](type.ArrayViewMut.html#method.into_slice)[2](#req_contig_std) -/// `Array0` | `A` | [`.into_scalar()`](type.Array.html#method.into_scalar) +/// `Vec` | `ArrayBase` | [`::from_vec()`](Self::from_vec) +/// `Vec` | `ArrayBase` | [`::from_shape_vec()`](Self::from_shape_vec) +/// `&[A]` | `ArrayView1` | [`::from()`](ArrayView#method.from) +/// `&[A]` | `ArrayView` | [`::from_shape()`](ArrayView#method.from_shape) +/// `&mut [A]` | `ArrayViewMut1` | [`::from()`](ArrayViewMut#method.from) +/// `&mut [A]` | `ArrayViewMut` | [`::from_shape()`](ArrayViewMut#method.from_shape) +/// `&ArrayBase` | `Vec` | [`.to_vec()`](Self::to_vec) +/// `Array` | `Vec` | [`.into_raw_vec()`](Array#method.into_raw_vec)[1](#into_raw_vec) +/// `&ArrayBase` | `&[A]` | [`.as_slice()`](Self::as_slice)[2](#req_contig_std), [`.as_slice_memory_order()`](Self::as_slice_memory_order)[3](#req_contig) +/// `&mut ArrayBase` | `&mut [A]` | [`.as_slice_mut()`](Self::as_slice_mut)[2](#req_contig_std), [`.as_slice_memory_order_mut()`](Self::as_slice_memory_order_mut)[3](#req_contig) +/// `ArrayView` | `&[A]` | [`.to_slice()`](ArrayView#method.to_slice)[2](#req_contig_std) +/// `ArrayViewMut` | `&mut [A]` | [`.into_slice()`](ArrayViewMut#method.into_slice)[2](#req_contig_std) +/// `Array0` | `A` | [`.into_scalar()`](Array#method.into_scalar) /// /// 1Returns the data in memory order. /// @@ -1066,16 +1058,16 @@ pub type Ixs = isize; /// conversions to/from `Vec`s/slices. See /// [below](#constructor-methods-for-owned-arrays) for more constructors. /// -/// [ArrayView::reborrow()]: type.ArrayView.html#method.reborrow -/// [ArrayViewMut::reborrow()]: type.ArrayViewMut.html#method.reborrow -/// [.into_dimensionality()]: #method.into_dimensionality -/// [.into_dyn()]: #method.into_dyn -/// [.into_owned()]: #method.into_owned -/// [.into_shared()]: #method.into_shared -/// [.to_owned()]: #method.to_owned -/// [.map()]: #method.map -/// [.view()]: #method.view -/// [.view_mut()]: #method.view_mut +/// [ArrayView::reborrow()]: ArrayView#method.reborrow +/// [ArrayViewMut::reborrow()]: ArrayViewMut#method.reborrow +/// [.into_dimensionality()]: Self::into_dimensionality +/// [.into_dyn()]: Self::into_dyn +/// [.into_owned()]: Self::into_owned +/// [.into_shared()]: Self::into_shared +/// [.to_owned()]: Self::to_owned +/// [.map()]: Self::map +/// [.view()]: Self::view +/// [.view_mut()]: Self::view_mut /// /// ### Conversions from Nested `Vec`s/`Array`s /// @@ -1117,7 +1109,7 @@ pub type Ixs = isize; /// If you don't know ahead-of-time the shape of the final array, then the /// cleanest solution is generally to append the data to a flat `Vec`, and then /// convert it to an `Array` at the end with -/// [`::from_shape_vec()`](#method.from_shape_vec). You just have to be careful +/// [`::from_shape_vec()`](Self::from_shape_vec). You just have to be careful /// that the layout of the data (the order of the elements in the flat `Vec`) /// is correct. /// @@ -1140,10 +1132,9 @@ pub type Ixs = isize; /// /// If neither of these options works for you, and you really need to convert /// nested `Vec`/`Array` instances to an `Array`, the cleanest solution is -/// generally to use -/// [`Iterator::flatten()`](https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.flatten) +/// generally to use [`Iterator::flatten()`] /// to get a flat `Vec`, and then convert the `Vec` to an `Array` with -/// [`::from_shape_vec()`](#method.from_shape_vec), like this: +/// [`::from_shape_vec()`](Self::from_shape_vec), like this: /// /// ```rust /// use ndarray::{array, Array2, Array3}; @@ -1306,20 +1297,20 @@ where /// It can act as both an owner as the data as well as a shared reference (view /// like). /// Calling a method for mutating elements on `ArcArray`, for example -/// [`view_mut()`](struct.ArrayBase.html#method.view_mut) or -/// [`get_mut()`](struct.ArrayBase.html#method.get_mut), will break sharing and +/// [`view_mut()`](ArrayBase::view_mut) or +/// [`get_mut()`](ArrayBase::get_mut), will break sharing and /// require a clone of the data (if it is not uniquely held). /// /// `ArcArray` uses atomic reference counting like `Arc`, so it is `Send` and /// `Sync` (when allowed by the element type of the array too). /// -/// [**`ArrayBase`**](struct.ArrayBase.html) is used to implement both the owned +/// **[`ArrayBase`]** is used to implement both the owned /// arrays and the views; see its docs for an overview of all array features. /// /// See also: /// -/// + [Constructor Methods for Owned Arrays](struct.ArrayBase.html#constructor-methods-for-owned-arrays) -/// + [Methods For All Array Types](struct.ArrayBase.html#methods-for-all-array-types) +/// + [Constructor Methods for Owned Arrays](ArrayBase#constructor-methods-for-owned-arrays) +/// + [Methods For All Array Types](ArrayBase#methods-for-all-array-types) pub type ArcArray = ArrayBase, D>; /// An array that owns its data uniquely. @@ -1330,18 +1321,18 @@ pub type ArcArray = ArrayBase, D>; /// The `Array` is parameterized by `A` for the element type and `D` for /// the dimensionality. /// -/// [**`ArrayBase`**](struct.ArrayBase.html) is used to implement both the owned +/// **[`ArrayBase`]** is used to implement both the owned /// arrays and the views; see its docs for an overview of all array features. /// /// See also: /// -/// + [Constructor Methods for Owned Arrays](struct.ArrayBase.html#constructor-methods-for-owned-arrays) -/// + [Methods For All Array Types](struct.ArrayBase.html#methods-for-all-array-types) +/// + [Constructor Methods for Owned Arrays](ArrayBase#constructor-methods-for-owned-arrays) +/// + [Methods For All Array Types](ArrayBase#methods-for-all-array-types) /// + Dimensionality-specific type alises -/// [`Array1`](type.Array1.html), -/// [`Array2`](type.Array2.html), -/// [`Array3`](type.Array3.html), ..., -/// [`ArrayD`](type.ArrayD.html), +/// [`Array1`], +/// [`Array2`], +/// [`Array3`], ..., +/// [`ArrayD`], /// and so on. pub type Array = ArrayBase, D>; @@ -1350,20 +1341,17 @@ pub type Array = ArrayBase, D>; /// An `CowArray` represents either a uniquely owned array or a view of an /// array. The `'a` corresponds to the lifetime of the view variant. /// -/// This type is analogous to -/// [`std::borrow::Cow`](https://doc.rust-lang.org/std/borrow/enum.Cow.html). +/// This type is analogous to [`std::borrow::Cow`]. /// If a `CowArray` instance is the immutable view variant, then calling a /// method for mutating elements in the array will cause it to be converted /// into the owned variant (by cloning all the elements) before the /// modification is performed. /// -/// Array views have all the methods of an array (see [`ArrayBase`][ab]). +/// Array views have all the methods of an array (see [`ArrayBase`]). /// -/// See also [`ArcArray`](type.ArcArray.html), which also provides +/// See also [`ArcArray`], which also provides /// copy-on-write behavior but has a reference-counted pointer to the data /// instead of either a view or a uniquely owned copy. -/// -/// [ab]: struct.ArrayBase.html pub type CowArray<'a, A, D> = ArrayBase, D>; /// A read-only array view. @@ -1374,11 +1362,9 @@ pub type CowArray<'a, A, D> = ArrayBase, D>; /// The `ArrayView<'a, A, D>` is parameterized by `'a` for the scope of the /// borrow, `A` for the element type and `D` for the dimensionality. /// -/// Array views have all the methods of an array (see [`ArrayBase`][ab]). -/// -/// See also [`ArrayViewMut`](type.ArrayViewMut.html). +/// Array views have all the methods of an array (see [`ArrayBase`]). /// -/// [ab]: struct.ArrayBase.html +/// See also [`ArrayViewMut`]. pub type ArrayView<'a, A, D> = ArrayBase, D>; /// A read-write array view. @@ -1389,11 +1375,9 @@ pub type ArrayView<'a, A, D> = ArrayBase, D>; /// The `ArrayViewMut<'a, A, D>` is parameterized by `'a` for the scope of the /// borrow, `A` for the element type and `D` for the dimensionality. /// -/// Array views have all the methods of an array (see [`ArrayBase`][ab]). +/// Array views have all the methods of an array (see [`ArrayBase`]). /// -/// See also [`ArrayView`](type.ArrayView.html). -/// -/// [ab]: struct.ArrayBase.html +/// See also [`ArrayView`]. pub type ArrayViewMut<'a, A, D> = ArrayBase, D>; /// A read-only array view without a lifetime. @@ -1405,15 +1389,13 @@ pub type ArrayViewMut<'a, A, D> = ArrayBase, D>; /// T` and `&T`, but `RawArrayView` has additional requirements that `*const T` /// does not, such as non-nullness. /// -/// [`ArrayView`]: type.ArrayView.html -/// /// The `RawArrayView` is parameterized by `A` for the element type and /// `D` for the dimensionality. /// /// Raw array views have all the methods of an array (see -/// [`ArrayBase`](struct.ArrayBase.html)). +/// [`ArrayBase`]). /// -/// See also [`RawArrayViewMut`](type.RawArrayViewMut.html). +/// See also [`RawArrayViewMut`]. /// /// # Warning /// @@ -1430,15 +1412,13 @@ pub type RawArrayView = ArrayBase, D>; /// relationship between `*mut T` and `&mut T`, but `RawArrayViewMut` has /// additional requirements that `*mut T` does not, such as non-nullness. /// -/// [`ArrayViewMut`]: type.ArrayViewMut.html -/// /// The `RawArrayViewMut` is parameterized by `A` for the element type /// and `D` for the dimensionality. /// /// Raw array views have all the methods of an array (see -/// [`ArrayBase`](struct.ArrayBase.html)). +/// [`ArrayBase`]). /// -/// See also [`RawArrayView`](type.RawArrayView.html). +/// See also [`RawArrayView`]. /// /// # Warning /// @@ -1451,7 +1431,7 @@ pub use data_repr::OwnedRepr; /// ArcArray's representation. /// /// *Don’t use this type directly—use the type alias -/// [`ArcArray`](type.ArcArray.html) for the array type!* +/// [`ArcArray`] for the array type!* #[derive(Debug)] pub struct OwnedArcRepr(Arc>); @@ -1464,8 +1444,7 @@ impl Clone for OwnedArcRepr { /// Array pointer’s representation. /// /// *Don’t use this type directly—use the type aliases -/// [`RawArrayView`](type.RawArrayView.html) / -/// [`RawArrayViewMut`](type.RawArrayViewMut.html) for the array type!* +/// [`RawArrayView`] / [`RawArrayViewMut`] for the array type!* #[derive(Copy, Clone)] // This is just a marker type, to carry the mutability and element type. pub struct RawViewRepr { @@ -1482,8 +1461,7 @@ impl RawViewRepr { /// Array view’s representation. /// /// *Don’t use this type directly—use the type aliases -/// [`ArrayView`](type.ArrayView.html) -/// / [`ArrayViewMut`](type.ArrayViewMut.html) for the array type!* +/// [`ArrayView`] / [`ArrayViewMut`] for the array type!* #[derive(Copy, Clone)] // This is just a marker type, to carry the lifetime parameter. pub struct ViewRepr { @@ -1500,7 +1478,7 @@ impl ViewRepr { /// CowArray's representation. /// /// *Don't use this type directly—use the type alias -/// [`CowArray`](type.CowArray.html) for the array type!* +/// [`CowArray`] for the array type!* pub enum CowRepr<'a, A> { /// Borrowed data. View(ViewRepr<&'a A>), diff --git a/src/slice.rs b/src/slice.rs index 113b82d05..6562a3d36 100644 --- a/src/slice.rs +++ b/src/slice.rs @@ -20,7 +20,7 @@ use std::ops::{Deref, Range, RangeFrom, RangeFull, RangeInclusive, RangeTo, Rang /// from the back of the axis. If `end` is `None`, the slice extends to the end /// of the axis. /// -/// See also the [`s![]`](macro.s.html) macro. +/// See also the [`s![]`](s!) macro. /// /// ## Examples /// @@ -75,13 +75,13 @@ impl Slice { /// Token to represent a new axis in a slice description. /// -/// See also the [`s![]`](macro.s!.html) macro. +/// See also the [`s![]`](s!) macro. #[derive(Clone, Copy, Debug)] pub struct NewAxis; /// A slice (range with step), an index, or a new axis token. /// -/// See also the [`s![]`](macro.s!.html) macro for a convenient way to create a +/// See also the [`s![]`](s!) macro for a convenient way to create a /// `SliceInfo<[SliceInfoElem; n], Din, Dout>`. /// /// ## Examples @@ -397,7 +397,7 @@ unsafe impl SliceArg for [SliceInfoElem] { /// `SliceInfo` instance can still be used to slice an array with dimension /// `IxDyn` as long as the number of axes matches. /// -/// [`.slice()`]: struct.ArrayBase.html#method.slice +/// [`.slice()`]: crate::ArrayBase::slice #[derive(Debug)] pub struct SliceInfo { in_dim: PhantomData, @@ -486,7 +486,7 @@ where } /// Returns the number of dimensions of the input array for - /// [`.slice()`](struct.ArrayBase.html#method.slice). + /// [`.slice()`](crate::ArrayBase::slice). /// /// If `Din` is a fixed-size dimension type, then this is equivalent to /// `Din::NDIM.unwrap()`. Otherwise, the value is calculated by iterating @@ -500,7 +500,7 @@ where } /// Returns the number of dimensions after calling - /// [`.slice()`](struct.ArrayBase.html#method.slice) (including taking + /// [`.slice()`](crate::ArrayBase::slice) (including taking /// subviews). /// /// If `Dout` is a fixed-size dimension type, then this is equivalent to @@ -703,9 +703,6 @@ impl_slicenextdim!((), NewAxis, Ix0, Ix1); /// * *new-axis*: a [`NewAxis`] instance that represents the creation of a new axis. /// (Except for [`.slice_collapse()`], which panics on [`NewAxis`] elements.) /// -/// [`Slice`]: struct.Slice.html -/// [`NewAxis`]: struct.NewAxis.html -/// /// The number of *elem*, not including *new-axis*, must match the /// number of axes in the array. *index*, *range*, *slice*, *step*, and /// *new-axis* can be expressions. *index* must be of type `isize`, `usize`, or @@ -722,12 +719,12 @@ impl_slicenextdim!((), NewAxis, Ix0, Ix1); /// panic. Without the `NewAxis`, i.e. `s![0..4;2, 6, 1..5]`, /// [`.slice_collapse()`] would result in an array of shape `[2, 1, 4]`. /// -/// [`.slice()`]: struct.ArrayBase.html#method.slice -/// [`.slice_mut()`]: struct.ArrayBase.html#method.slice_mut -/// [`.slice_move()`]: struct.ArrayBase.html#method.slice_move -/// [`.slice_collapse()`]: struct.ArrayBase.html#method.slice_collapse +/// [`.slice()`]: crate::ArrayBase::slice +/// [`.slice_mut()`]: crate::ArrayBase::slice_mut +/// [`.slice_move()`]: crate::ArrayBase::slice_move +/// [`.slice_collapse()`]: crate::ArrayBase::slice_collapse /// -/// See also [*Slicing*](struct.ArrayBase.html#slicing). +/// See also [*Slicing*](crate::ArrayBase#slicing). /// /// # Example /// diff --git a/src/stacking.rs b/src/stacking.rs index fb05c1963..e2a070433 100644 --- a/src/stacking.rs +++ b/src/stacking.rs @@ -178,11 +178,9 @@ where /// Stack arrays along the new axis. /// -/// Uses the [`stack`][1] function, calling `ArrayView::from(&a)` on each +/// Uses the [`stack()`] function, calling `ArrayView::from(&a)` on each /// argument `a`. /// -/// [1]: fn.stack.html -/// /// ***Panics*** if the `stack` function would return an error. /// /// ``` @@ -212,11 +210,9 @@ macro_rules! stack { /// Concatenate arrays along the given axis. /// -/// Uses the [`concatenate`][1] function, calling `ArrayView::from(&a)` on each +/// Uses the [`concatenate()`] function, calling `ArrayView::from(&a)` on each /// argument `a`. /// -/// [1]: fn.concatenate.html -/// /// ***Panics*** if the `concatenate` function would return an error. /// /// ``` @@ -246,11 +242,9 @@ macro_rules! concatenate { /// Stack arrays along the new axis. /// -/// Uses the [`stack_new_axis`][1] function, calling `ArrayView::from(&a)` on each +/// Uses the [`stack_new_axis()`] function, calling `ArrayView::from(&a)` on each /// argument `a`. /// -/// [1]: fn.stack_new_axis.html -/// /// ***Panics*** if the `stack` function would return an error. /// /// ``` diff --git a/src/zip/mod.rs b/src/zip/mod.rs index d611fabbc..2d352e82a 100644 --- a/src/zip/mod.rs +++ b/src/zip/mod.rs @@ -37,9 +37,7 @@ macro_rules! fold_while { /// Broadcast an array so that it acts like a larger size and/or shape array. /// -/// See [broadcasting][1] for more information. -/// -/// [1]: struct.ArrayBase.html#broadcasting +/// See [broadcasting](ArrayBase#broadcasting) for more information. trait Broadcast where E: IntoDimension, @@ -120,7 +118,7 @@ trait ZippableTuple: Sized { /// a time). /// /// In general, the zip uses a tuple of producers -/// ([`NdProducer`](trait.NdProducer.html) trait) that all have to be of the +/// ([`NdProducer`] trait) that all have to be of the /// same shape. The NdProducer implementation defines what its item type is /// (for example if it's a shared reference, mutable reference or an array /// view etc). @@ -135,11 +133,9 @@ trait ZippableTuple: Sized { /// `fold_while`. The zip object can be split, which allows parallelization. /// A read-only zip object (no mutable producers) can be cloned. /// -/// See also the [`azip!()` macro][az] which offers a convenient shorthand +/// See also the [`azip!()`] which offers a convenient shorthand /// to common ways to use `Zip`. /// -/// [az]: macro.azip.html -/// /// ``` /// use ndarray::Zip; /// use ndarray::Array2; diff --git a/src/zip/ndproducer.rs b/src/zip/ndproducer.rs index 7c201741c..619fadcc3 100644 --- a/src/zip/ndproducer.rs +++ b/src/zip/ndproducer.rs @@ -36,8 +36,8 @@ where /// for example an array view, mutable array view or an iterator /// that yields chunks. /// -/// Producers are used as a arguments to [`Zip`](struct.Zip.html) and -/// [`azip!()`](macro.azip.html). +/// Producers are used as a arguments to [`Zip`](crate::Zip) and +/// [`azip!()`]. /// /// # Comparison to `IntoIterator` /// @@ -51,7 +51,7 @@ where /// (`AxisIter` traverses a one dimensional sequence, along an axis, while /// *producing* multidimensional items). /// -/// See also [`IntoNdProducer`](trait.IntoNdProducer.html) +/// See also [`IntoNdProducer`] pub trait NdProducer { /// The element produced per iteration. type Item; diff --git a/src/zip/zipmacro.rs b/src/zip/zipmacro.rs index f25e33d31..d7754ed92 100644 --- a/src/zip/zipmacro.rs +++ b/src/zip/zipmacro.rs @@ -1,7 +1,7 @@ /// Array zip macro: lock step function application across several arrays and /// producers. /// -/// This is a shorthand for [`Zip`](struct.Zip.html). +/// This is a shorthand for [`Zip`](crate::Zip). /// /// This example: ///