Skip to content

Commit

Permalink
Merge branch 'main' into arrow-array
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrobbel committed Aug 7, 2023
2 parents 9494ce2 + b6b922c commit 42ba214
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
7 changes: 0 additions & 7 deletions src/array/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,6 @@ impl_array_type!(Option<f64>, FixedSizePrimitiveArray<f64, true, Buffer>);
impl_array_type!((), NullArray<(), false, Buffer>);
impl_array_type!(Option<()>, NullArray<(), true, Buffer>);

impl<T: FixedSize> ArrayType for (T,) {
type Array<Buffer: BufferType> = FixedSizePrimitiveArray<(T,), false, Buffer>;
}
impl<T: FixedSize> ArrayType for Option<(T,)> {
type Array<Buffer: BufferType> = FixedSizePrimitiveArray<(T,), true, Buffer>;
}

impl<T: FixedSize, const N: usize> ArrayType for [T; N] {
type Array<Buffer: BufferType> = FixedSizePrimitiveArray<[T; N], false, Buffer>;
}
Expand Down
6 changes: 2 additions & 4 deletions src/fixed_size.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Subtrait for fixed-size types.
use crate::array::ArrayType;
use std::fmt::Debug;
use std::{fmt::Debug, mem};

/// Subtrait for fixed-size types.
///
Expand All @@ -13,7 +13,7 @@ use std::fmt::Debug;
#[cfg(not(feature = "arrow-buffer"))]
pub trait FixedSize: ArrayType + Copy + Debug + Sized + sealed::Sealed + 'static {
/// The fixed-size of this type in bytes.
const SIZE: usize = std::mem::size_of::<Self>();
const SIZE: usize = mem::size_of::<Self>();
}

#[cfg(feature = "arrow-buffer")]
Expand Down Expand Up @@ -42,7 +42,6 @@ impl FixedSize for f32 {}
impl FixedSize for f64 {}

impl FixedSize for () {}
impl<T: FixedSize> FixedSize for (T,) {}

impl<const N: usize, T: FixedSize> FixedSize for [T; N] {}

Expand All @@ -61,7 +60,6 @@ mod tests {
#[test]
fn size() {
assert_eq!(<()>::SIZE, 0);
assert_eq!(<(u8,)>::SIZE, 1);
assert_eq!(u8::SIZE, 1);
assert_eq!(<[u16; 21]>::SIZE, 42);
assert_eq!(<[u8; 1234]>::SIZE, 1234);
Expand Down

0 comments on commit 42ba214

Please sign in to comment.