Struct zarrs::array_subset::iterators::Chunks
source · pub struct Chunks { /* private fields */ }
Expand description
Iterates over the regular sized chunks overlapping this array subset.
Iterates over the last dimension fastest (i.e. C-contiguous order). All chunks have the same size, and may extend over the bounds of the array subset since the start of the first chunk is aligned to the chunk size.
The iterator item is a (ArrayIndices
, ArraySubset
) tuple corresponding to the chunk indices and array subset.
For example, consider a 4x3 array with element indices
(0, 0) (0, 1) (0, 2)
(1, 0) (1, 1) (1, 2)
(2, 0) (2, 1) (2, 2)
(3, 0) (3, 1) (3, 2)
An 2x2 chunks iterator with an array subset covering the entire array will produce
[
((0, 0), ArraySubset{offset: (0,0), shape: (2, 2)}),
((0, 1), ArraySubset{offset: (0,2), shape: (2, 2)}),
((1, 0), ArraySubset{offset: (2,0), shape: (2, 2)}),
((1, 1), ArraySubset{offset: (2,2), shape: (2, 2)}),
]
Implementations§
source§impl Chunks
impl Chunks
sourcepub fn new(
subset: &ArraySubset,
chunk_shape: &[NonZeroU64],
) -> Result<Self, IncompatibleDimensionalityError>
pub fn new( subset: &ArraySubset, chunk_shape: &[NonZeroU64], ) -> Result<Self, IncompatibleDimensionalityError>
Create a new chunks iterator.
§Errors
Returns IncompatibleDimensionalityError
if chunk_shape
does not match the dimensionality of subset
.
sourcepub unsafe fn new_unchecked(
subset: &ArraySubset,
chunk_shape: &[NonZeroU64],
) -> Self
pub unsafe fn new_unchecked( subset: &ArraySubset, chunk_shape: &[NonZeroU64], ) -> Self
Create a new chunks iterator.
§Safety
The dimensionality of chunk_shape
must match the dimensionality of subset
.
sourcepub fn iter(&self) -> ChunksIterator<'_> ⓘ
pub fn iter(&self) -> ChunksIterator<'_> ⓘ
Create a new serial iterator.
Trait Implementations§
source§impl<'a> IntoIterator for &'a Chunks
impl<'a> IntoIterator for &'a Chunks
source§impl<'a> IntoParallelIterator for &'a Chunks
impl<'a> IntoParallelIterator for &'a Chunks
Auto Trait Implementations§
impl Freeze for Chunks
impl RefUnwindSafe for Chunks
impl Send for Chunks
impl Sync for Chunks
impl Unpin for Chunks
impl UnwindSafe for Chunks
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<'data, I> IntoParallelRefIterator<'data> for I
impl<'data, I> IntoParallelRefIterator<'data> for I
§type Iter = <&'data I as IntoParallelIterator>::Iter
type Iter = <&'data I as IntoParallelIterator>::Iter
§type Item = <&'data I as IntoParallelIterator>::Item
type Item = <&'data I as IntoParallelIterator>::Item
&'data T
reference type.