Skip to content

Commit 85f5e40

Browse files
committed
More docs
1 parent 00eba67 commit 85f5e40

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/array.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,20 +93,32 @@ impl<T> Array<T> {
9393
.0
9494
}
9595

96+
/// Returns an iterator over references to the elements of the array in the
97+
/// higher-dimensional equivalent of row-major order.
9698
pub fn iter<'a>(&'a self) -> Iter<'a, T> {
9799
Iter {
98100
inner: self.data.iter(),
99101
}
100102
}
101103

104+
/// Returns an iterator over mutable references to the elements of the
105+
/// array in the higher-dimensional equivalent of row-major order.
102106
pub fn iter_mut<'a>(&'a mut self) -> IterMut<'a, T> {
103107
IterMut {
104108
inner: self.data.iter_mut(),
105109
}
106110
}
107111
}
108112

113+
/// A trait implemented by types that can index into an `Array`.
109114
pub trait ArrayIndex {
115+
/// Calculates the index into the `Array`'s underlying storage specified
116+
/// by the value of `self`.
117+
///
118+
/// # Panics
119+
///
120+
/// Panics if the value of `self` does not correspond to an in-bounds
121+
/// element of the `Array`.
110122
fn index<T>(&self, array: &Array<T>) -> usize;
111123
}
112124

src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@ pub use array::Array;
1111
pub mod array;
1212
mod impls;
1313

14+
/// Information about a dimension of an array.
1415
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
1516
pub struct Dimension {
17+
/// The length of the dimension.
1618
pub len: usize,
19+
/// The index of the first element of the dimension.
1720
pub lower_bound: isize,
1821
}
1922

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy