From 5631f307c6224ab3e8a5c0d83a34f2c8f30d2e4e Mon Sep 17 00:00:00 2001 From: Lachlan Deakin Date: Mon, 12 Feb 2024 17:53:19 +1100 Subject: [PATCH] Additional `ArraySubset` iterators docs --- CHANGELOG.md | 2 +- src/array_subset/iterators.rs | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ab8643d..dca35423 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,7 +48,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **Major breaking**: refactor array subset iterators: - `ArraySubset::iter_` methods no longer have an `iter_` prefix and return structures implementing `IntoIterator` including - `Indices`, `LinearisedIndices`, `ContiguousIndices`, `ContiguousLinearisedIndices`, `Chunks` - - `Indices` and `Chunks` implement `IntoParIter` + - `Indices` and `Chunks` implement `IntoParallelIter` - **Breaking**: array subset iterators are moved into public `array_subset::iterators` and no longer in the `array_subset` namespace ### Removed diff --git a/src/array_subset/iterators.rs b/src/array_subset/iterators.rs index 705d2bb8..bff94391 100644 --- a/src/array_subset/iterators.rs +++ b/src/array_subset/iterators.rs @@ -1,4 +1,21 @@ //! Array subset iterators. +//! +//! The iterators are: +//! - [`Indices`]: iterate over the multidimensional indices of the elements in the subset. +//! - [`LinearisedIndices`]: iterate over linearised indices of the elements in the subset. +//! - [`ContiguousIndices`]: iterate over contiguous sets of elements in the subset with the start a multidimensional index. +//! - [`ContiguousLinearisedIndices`]: iterate over contiguous sets of elements in the subset with the start a linearised index. +//! - [`Chunks`]: iterate over regular sized chunks in the array subset. +//! +//! These can be created with the appropriate [`ArraySubset`](super::ArraySubset) methods including +//! [`indices`](super::ArraySubset::indices), +//! [`linearised_indices`](super::ArraySubset::linearised_indices), +//! [`contiguous_indices`](super::ArraySubset::contiguous_indices), +//! [`contiguous_linearised_indices`](super::ArraySubset::contiguous_linearised_indices), and +//! [`chunks`](super::ArraySubset::chunks). +//! +//! All iterators support [`into_iter()`](IntoIterator::into_iter) ([`IntoIterator`]). +//! The [`Indices`] and [`Chunks`] iterators also support [`rayon`]'s [`into_par_iter()`](rayon::iter::IntoParallelIterator::into_par_iter) ([`IntoParallelIterator`](rayon::iter::IntoParallelIterator)). mod chunks_iterator; mod contiguous_indices_iterator;