Skip to content

Commit a44d71f

Browse files
authored
Fills missing documentation and adds warn(missing_docs) (#1525)
1 parent aa135d4 commit a44d71f

File tree

7 files changed

+29
-0
lines changed

7 files changed

+29
-0
lines changed

src/dimension/broadcast.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ where
3434
Ok(out)
3535
}
3636

37+
/// A trait to specify when one dimension is strictly larger than another.
38+
///
39+
/// Broadcasting two arrays together frequently requires typing the resultant
40+
/// array has having a dimensionality equal to the maximum of the two input arrays.
41+
/// This trait is what determines that typing.
42+
///
43+
/// For example, `Ix1: DimMax<Ix0>`, but not vice-versa.
3744
pub trait DimMax<Other: Dimension>
3845
{
3946
/// The resulting dimension type after broadcasting.

src/dimension/conversion.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ macro_rules! index_item {
4242
/// Argument conversion a dimension.
4343
pub trait IntoDimension
4444
{
45+
/// The concrete type of the resultant dimension.
4546
type Dim: Dimension;
47+
48+
/// Convert into a type that implements [`Dimension`].
4649
fn into_dimension(self) -> Self::Dim;
4750
}
4851

src/dimension/remove_axis.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use crate::{Axis, Dim, Dimension, Ix, Ix0, Ix1};
1414
/// removing one axis from *Self* gives smaller dimension *Smaller*.
1515
pub trait RemoveAxis: Dimension
1616
{
17+
/// Remove the specified axis from a dimension.
1718
fn remove_axis(&self, axis: Axis) -> Self::Smaller;
1819
}
1920

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#![cfg_attr(not(feature = "std"), no_std)]
2323
// Enable the doc_cfg nightly feature for including feature gate flags in the documentation
2424
#![cfg_attr(docsrs, feature(doc_cfg))]
25+
#![warn(missing_docs)]
2526

2627
//! The `ndarray` crate provides an *n*-dimensional container for general elements
2728
//! and for numerics.

src/linalg/impl_linalg.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,9 @@ pub trait Dot<Rhs>
164164
/// For two-dimensional arrays: a rectangular array.
165165
type Output;
166166

167+
/// Compute the dot product of two arrays.
168+
///
169+
/// **Panics** if the arrays' shapes are not compatible.
167170
fn dot(&self, rhs: &Rhs) -> Self::Output;
168171
}
169172

src/shape_builder.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,22 @@ impl<D> Strides<D>
9696
/// `Array::from_shape_vec`.
9797
pub trait ShapeBuilder
9898
{
99+
/// The type that captures the built shape's dimensionality.
99100
type Dim: Dimension;
101+
102+
/// The type that captures the built shape's stride pattern.
100103
type Strides;
101104

105+
/// Turn into a contiguous-element [`Shape`].
102106
fn into_shape_with_order(self) -> Shape<Self::Dim>;
107+
108+
/// Convert into a Fortran-order (a.k.a., column-order) [`Shape`].
103109
fn f(self) -> Shape<Self::Dim>;
110+
111+
/// Set the order of the shape to either Fortran or non-Fortran.
104112
fn set_f(self, is_f: bool) -> Shape<Self::Dim>;
113+
114+
/// Set the strides of the shape.
105115
fn strides(self, strides: Self::Strides) -> StrideShape<Self::Dim>;
106116
}
107117

@@ -213,7 +223,10 @@ where D: Dimension
213223
/// See for example [`.to_shape()`](crate::ArrayRef::to_shape).
214224
pub trait ShapeArg
215225
{
226+
/// The type that captures the shape's dimensionality.
216227
type Dim: Dimension;
228+
229+
/// Convert the argument into a shape and an [`Order`].
217230
fn into_shape_and_order(self) -> (Self::Dim, Option<Order>);
218231
}
219232

src/zip/ndproducer.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ pub trait IntoNdProducer
1616
type Item;
1717
/// Dimension type of the producer
1818
type Dim: Dimension;
19+
/// The concrete type of the producer
1920
type Output: NdProducer<Dim = Self::Dim, Item = Self::Item>;
2021
/// Convert the value into an `NdProducer`.
2122
fn into_producer(self) -> Self::Output;

0 commit comments

Comments
 (0)