Skip to content

Commit 70054de

Browse files
committed
Document the Hyperslab
1 parent 3dd029f commit 70054de

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

src/hl/container.rs

+1
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ impl<'a> Writer<'a> {
346346

347347
#[repr(transparent)]
348348
#[derive(Clone)]
349+
/// An object which can be read or written to.
349350
pub struct Container(Handle);
350351

351352
impl ObjectClass for Container {

src/hl/selection.rs

+47
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,47 @@ impl RawSelection {
219219
}
220220
}
221221

222+
/// A selector of a one-dimensional array
223+
///
224+
/// The following examples will use an array of 11 elements
225+
/// to illustrate the various selections. The active elements
226+
/// are marked with an `s`.
227+
/// ```text
228+
/// // An array of 11 elements
229+
/// x x x x x x x x x x x
230+
/// ```
231+
///
232+
/// ```text
233+
/// Index(4)
234+
/// _ _ _ _ s _ _ _ _ _ _
235+
/// ```
236+
/// ```text
237+
/// Slice { start: 0, step: 3, end: 4, block: 1 }
238+
/// s _ _ s _ _ _ _ _ _ _
239+
/// ```
240+
/// ```text
241+
/// SliceTo { start: 2, step: 3, end: 8, block: 1 }
242+
/// _ _ s _ _ s _ _ _ _ _
243+
/// ```
244+
/// ```text
245+
/// SliceCount { start: 1, step: 3, count: 2, block: 1 }
246+
/// _ s _ _ s _ _ s _ _ _
247+
/// ```
248+
/// ```text
249+
/// Unlimited { start: 0, step: 3, block: 1 }
250+
/// s _ _ s _ _ s _ _ s _
251+
/// ```
252+
/// ```text
253+
/// Unlimited { start: 2, step: 3, block: 1 }
254+
/// _ _ s _ _ s _ _ s _ _
255+
/// ```
256+
/// ```text
257+
/// Unlimited { start: 0, step: 4, block: 2 }
258+
/// s s _ _ s s _ _ s s _
259+
/// ```
260+
///
261+
/// See also [`this hdf5 tutorial`](https://support.hdfgroup.org/HDF5/Tutor/select.html)
262+
/// for more information on hyperslab selections.
222263
#[derive(Clone, Copy, Debug, Eq)]
223264
pub enum SliceOrIndex {
224265
/// A single index
@@ -533,6 +574,11 @@ impl Display for SliceOrIndex {
533574
}
534575

535576
#[derive(Clone, Debug, PartialEq, Eq)]
577+
/// A descriptor of a selection of an N-dimensional array.
578+
///
579+
/// The Hyperslab consists of [`slices`](SliceOrIndex) in N dimensions,
580+
/// spanning an N-dimensional hypercube. This type is used as a [`selector`](Selection)
581+
/// for retrieving and putting data to a [`Container`](Container).
536582
pub struct Hyperslab {
537583
dims: Vec<SliceOrIndex>,
538584
}
@@ -723,6 +769,7 @@ impl Display for Hyperslab {
723769
}
724770

725771
#[derive(Clone, Debug, PartialEq, Eq)]
772+
/// A selection used for reading and writing to a [`Container`](Container).
726773
pub enum Selection {
727774
All,
728775
Points(Array2<Ix>),

0 commit comments

Comments
 (0)