Skip to content

Commit

Permalink
Change FillValueMetadata::Uint to UInt
Browse files Browse the repository at this point in the history
  • Loading branch information
LDeakin committed Oct 20, 2023
1 parent 2ed5481 commit d3fa241
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- **Breaking**: `StoragePartialDecoder` now takes a `ReadableStorage` input
- `sharded_array_write_read` example now prints storage operations and demonstrates retrieving inner chunks directly from a partial decoder
- the zarrs version and a link to the source code is now written to the `_zarrs` attribute in array metadata, this can be disabled with `set_include_zarrs_metadata(false)`
- **Breaking**: Rename `FillValueMetadata::Uint` to `UInt` for consistency with the `DataType::UInt` variants.

### Fixed
- Bytes codec handling of complex and raw bits data types
Expand Down
8 changes: 4 additions & 4 deletions src/array/data_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,15 +296,15 @@ impl DataType {
}
Self::Int64 => FillValueMetadata::Int(i64::from_ne_bytes(bytes.try_into().unwrap())),
Self::UInt8 => {
FillValueMetadata::Uint(u64::from(u8::from_ne_bytes(bytes.try_into().unwrap())))
FillValueMetadata::UInt(u64::from(u8::from_ne_bytes(bytes.try_into().unwrap())))
}
Self::UInt16 => {
FillValueMetadata::Uint(u64::from(u16::from_ne_bytes(bytes.try_into().unwrap())))
FillValueMetadata::UInt(u64::from(u16::from_ne_bytes(bytes.try_into().unwrap())))
}
Self::UInt32 => {
FillValueMetadata::Uint(u64::from(u32::from_ne_bytes(bytes.try_into().unwrap())))
FillValueMetadata::UInt(u64::from(u32::from_ne_bytes(bytes.try_into().unwrap())))
}
Self::UInt64 => FillValueMetadata::Uint(u64::from_ne_bytes(bytes.try_into().unwrap())),
Self::UInt64 => FillValueMetadata::UInt(u64::from_ne_bytes(bytes.try_into().unwrap())),
Self::Float16 => {
let fill_value = f16::from_ne_bytes(fill_value.as_ne_bytes().try_into().unwrap());
FillValueMetadata::Float(float16_to_fill_value_float(fill_value))
Expand Down
8 changes: 4 additions & 4 deletions src/array/fill_value_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub enum FillValueMetadata {
/// A boolean value.
Bool(bool),
/// An unsigned integer.
Uint(u64), // FIXME: UInt for consistency?
UInt(u64),
/// A signed integer.
Int(i64),
/// A float.
Expand Down Expand Up @@ -171,7 +171,7 @@ impl FillValueMetadata {
) -> Option<T> {
match self {
Self::Int(int) => T::try_from(*int).ok(),
Self::Uint(uint) => T::try_from(*uint).ok(),
Self::UInt(uint) => T::try_from(*uint).ok(),
_ => None,
}
}
Expand All @@ -183,7 +183,7 @@ impl FillValueMetadata {
) -> Option<T> {
match self {
Self::Int(int) => T::try_from(*int).ok(),
Self::Uint(uint) => T::try_from(*uint).ok(),
Self::UInt(uint) => T::try_from(*uint).ok(),
_ => None,
}
}
Expand Down Expand Up @@ -333,7 +333,7 @@ mod tests {
let metadata: FillValueMetadata = serde_json::from_str(json).unwrap();
assert_eq!(json, serde_json::to_string(&metadata).unwrap());
match metadata {
FillValueMetadata::Uint(fill_value) => {
FillValueMetadata::UInt(fill_value) => {
assert_eq!(fill_value, 7);
}
_ => panic!(),
Expand Down

0 comments on commit d3fa241

Please sign in to comment.