Skip to content

Commit

Permalink
Remove deprecated ArraySubset::{in_subset,in_subset_unchecked}
Browse files Browse the repository at this point in the history
  • Loading branch information
LDeakin committed Jan 21, 2024
1 parent 40429a6 commit 67f5cc1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 50 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- **Breaking**: `Array` `retrieve_` methods now return `Vec<u8>`/`Vec<T>` instead of `Box<[u8]>`/`Box<[T]>`
- This avoids potential internal reallocations
- **Breaking**: Remove `StorePrefixError::new`, deprecated since `v0.7.3`
- **Breaking**: `StoreKey::parent` now returns `StorePrefix` instead of `Option<StorePrefix>`
- **Breaking**: `ZipStorageAdapter::{new,new_with_path}` now take a `StoreKey`

### Removed
- **Breaking**: Remove `StorePrefixError::new`, deprecated since `v0.7.3`
- **Breaking**: Remove `ArraySubset::{in_subset,in_subset_unchecked}`, deprecated since `v0.7.2`

### Fixed
- Disallow an empty string for a `StoreKey`

Expand Down
49 changes: 0 additions & 49 deletions src/array_subset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -639,55 +639,6 @@ impl ArraySubset {
ChunksIterator::new_unchecked(self, chunk_shape)
}

#[deprecated(
since = "0.7.2",
note = "please use `overlap` and `relative_to` instead"
)]
/// Return the subset of this array subset in `subset_other`.
/// The start of the returned array subset is from the start of this array subset.
///
/// # Errors
///
/// Returns [`IncompatibleDimensionalityError`] if the dimensionality of `subset_other` does not match the dimensionality of this array subset.
pub fn in_subset(&self, subset_other: &Self) -> Result<Self, IncompatibleDimensionalityError> {
if subset_other.dimensionality() == self.dimensionality() {
#[allow(deprecated)]
Ok(unsafe { self.in_subset_unchecked(subset_other) })
} else {
Err(IncompatibleDimensionalityError::new(
subset_other.dimensionality(),
self.dimensionality(),
))
}
}

#[deprecated(
since = "0.7.2",
note = "please use `overlap` and `relative_to` instead"
)]
/// Return the subset of this array subset in `subset_other`.
/// The start of the returned array subset is from the start of this array subset.
///
/// # Safety
/// Panics if the dimensionality of `subset_other` does not match the dimensionality of this array subset.
#[must_use]
pub unsafe fn in_subset_unchecked(&self, subset_other: &Self) -> Self {
debug_assert_eq!(subset_other.dimensionality(), self.dimensionality());
let mut ranges = Vec::with_capacity(self.dimensionality());
for (start, size, other_start, other_size) in izip!(
&self.start,
&self.shape,
subset_other.start(),
subset_other.shape(),
) {
let output_start = start.saturating_sub(*other_start);
let output_end =
std::cmp::min((start + size).saturating_sub(*other_start), *other_size);
ranges.push(output_start..output_end);
}
Self::new_with_ranges(&ranges)
}

/// Return the overlapping subset between this array subset and `subset_other`.
///
/// # Errors
Expand Down

0 comments on commit 67f5cc1

Please sign in to comment.