Skip to content

Commit

Permalink
Minor array docs fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
LDeakin committed Feb 18, 2024
1 parent e9388ad commit 6da2db2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added `contiguous_elements` method to `ContiguousIndicesIterator` and `ContiguousLinearisedIndicesIterator`
- Added `ChunkShape::num_elements`
- Added `codec::CodecOptions{Builder}`
- Added new `Array::opt` methods which can use new encode/decode options
- **Breaking** Existing `Array` `_opt` use new encode/decode options insted of `parallel: bool`
- **Breaking**: Added new `Array::opt` methods which can use `codec::CodecOptions` and existing methods use it instead of `parallel: bool`
- Implement `DoubleEndedIterator` for `{Indices,LinearisedIndices,ContiguousIndices,ContiguousLinearisedIndicesIterator}Iterator`
- Add `ParIndicesIterator` and `ParChunksIterator`
- Implement `From<String>` for `DimensionName`
Expand Down
12 changes: 6 additions & 6 deletions src/array/array_async_readable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ impl<TStorage: ?Sized + AsyncReadableStorageTraits + 'static> Array<TStorage> {
.await
}

/// Read and decode the chunk at `chunk_indices` into its bytes.
/// Read and decode the chunks at `chunks` into their bytes.
///
/// # Errors
/// Returns an [`ArrayError`] if
Expand Down Expand Up @@ -346,14 +346,14 @@ impl<TStorage: ?Sized + AsyncReadableStorageTraits + 'static> Array<TStorage> {
}
}

/// Read and decode the chunk at `chunk_indices` into its bytes (default options).
/// Read and decode the chunks at `chunks` into their bytes (default options).
#[allow(clippy::missing_panics_doc, clippy::missing_errors_doc)]
pub async fn async_retrieve_chunks(&self, chunks: &ArraySubset) -> Result<Vec<u8>, ArrayError> {
self.async_retrieve_chunks_opt(chunks, &CodecOptions::default())
.await
}

/// Read and decode the chunk at `chunk_indices` into a vector of its elements.
/// Read and decode the chunks at `chunks` into a vector of their elements.
///
/// # Errors
/// Returns an [`ArrayError`] if the size of `T` does not match the data type size or a [`Array::async_retrieve_chunks`] error condition is met.
Expand All @@ -367,7 +367,7 @@ impl<TStorage: ?Sized + AsyncReadableStorageTraits + 'static> Array<TStorage> {
Ok(transmute_from_bytes_vec::<T>(bytes))
}

/// Read and decode the chunk at `chunk_indices` into a vector of its elements (default options).
/// Read and decode the chunks at `chunks` into a vector of their elements (default options).
///
/// # Errors
/// Returns an [`ArrayError`] if the size of `T` does not match the data type size or a [`Array::async_retrieve_chunks`] error condition is met.
Expand All @@ -380,7 +380,7 @@ impl<TStorage: ?Sized + AsyncReadableStorageTraits + 'static> Array<TStorage> {
}

#[cfg(feature = "ndarray")]
/// Read and decode the chunk at `chunk_indices` into an [`ndarray::ArrayD`].
/// Read and decode the chunks at `chunks` into an [`ndarray::ArrayD`].
///
/// # Errors
/// Returns an [`ArrayError`] if the size of `T` does not match the data type size or a [`Array::async_retrieve_chunks`] error condition is met.
Expand All @@ -398,7 +398,7 @@ impl<TStorage: ?Sized + AsyncReadableStorageTraits + 'static> Array<TStorage> {
}

#[cfg(feature = "ndarray")]
/// Read and decode the chunk at `chunk_indices` into an [`ndarray::ArrayD`] (default options).
/// Read and decode the chunks at `chunks` into an [`ndarray::ArrayD`] (default options).
#[allow(clippy::missing_panics_doc, clippy::missing_errors_doc)]
pub async fn async_retrieve_chunks_ndarray<T: bytemuck::Pod + Send + Sync>(
&self,
Expand Down
4 changes: 2 additions & 2 deletions src/array/array_sync_readable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ impl<TStorage: ?Sized + ReadableStorageTraits + 'static> Array<TStorage> {
self.retrieve_chunks_opt(chunks, &CodecOptions::default())
}

/// Read and decode the chunks at `chunks` into a vector of its elements.
/// Read and decode the chunks at `chunks` into a vector of their elements.
///
/// # Errors
/// Returns an [`ArrayError`] if any chunk indices in `chunks` are invalid or an error condition in [`Array::retrieve_chunks_opt`].
Expand All @@ -518,7 +518,7 @@ impl<TStorage: ?Sized + ReadableStorageTraits + 'static> Array<TStorage> {
Ok(transmute_from_bytes_vec::<T>(bytes))
}

/// Read and decode the chunks at `chunks` into a vector of its elements with default options
/// Read and decode the chunks at `chunks` into a vector of their elements (default options).
///
/// # Errors
/// See [`Array::retrieve_chunks_elements_opt`].
Expand Down
1 change: 1 addition & 0 deletions src/array/array_sync_readable_writable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ impl<TStorage: ?Sized + ReadableWritableStorageTraits + 'static> Array<TStorage>
unsafe { chunk_subset.contiguous_linearised_indices_unchecked(&chunk_shape) };
let length =
usize::try_from(contiguous_iterator.contiguous_elements() * element_size).unwrap();
// FIXME: Par iter?
for (chunk_element_index, _num_elements) in &contiguous_iterator {
let chunk_offset = usize::try_from(chunk_element_index * element_size).unwrap();
debug_assert!(chunk_offset + length <= chunk_bytes.len());
Expand Down

0 comments on commit 6da2db2

Please sign in to comment.