Struct arrow2::array::PrimitiveArray [−][src]
pub struct PrimitiveArray<T: NativeType> { /* fields omitted */ }
Expand description
A PrimitiveArray
is arrow’s equivalent to Vec<Option<T: NativeType>>
, i.e.
an array designed for highly performant operations on optionally nullable slots,
backed by a physical type of a fixed byte-width, such as i32
or f64
.
The size of this struct is O(1)
as all data is stored behind an std::sync::Arc
.
Example
use arrow2::array::{PrimitiveArray, Array};
use arrow2::bitmap::Bitmap;
let array = PrimitiveArray::from([Some(1), None, Some(10)]);
assert_eq!(array.values().as_slice(), &[1, 0, 10]);
assert_eq!(array.validity(), Some(&Bitmap::from([true, false, true])));
Implementations
Creates a (non-null) PrimitiveArray
from an iterator of values.
Implementation
This does not assume that the iterator has a known length.
Creates a (non-null) PrimitiveArray
from a slice of values.
Implementation
This is essentially a memcopy and is the fastest way to create a PrimitiveArray
.
Creates a (non-null) PrimitiveArray
from a TrustedLen
of values.
Implementation
This does not assume that the iterator has a known length.
Creates a new PrimitiveArray
from an iterator over values
Safety
The iterator must be TrustedLen
.
I.e. that size_hint().1
correctly reports its length.
Creates a PrimitiveArray
from a TrustedLen
of optional values.
Creates a PrimitiveArray
from an iterator of optional values.
Safety
The iterator must be TrustedLen
.
I.e. that size_hint().1
correctly reports its length.
pub fn iter(&'a self) -> ZipValidity<'a, &'a T, Iter<'a, T>>ⓘNotable traits for ZipValidity<'a, T, I>impl<'a, T, I: Iterator<Item = T>> Iterator for ZipValidity<'a, T, I> type Item = Option<T>;
pub fn iter(&'a self) -> ZipValidity<'a, &'a T, Iter<'a, T>>ⓘNotable traits for ZipValidity<'a, T, I>impl<'a, T, I: Iterator<Item = T>> Iterator for ZipValidity<'a, T, I> type Item = Option<T>;
impl<'a, T, I: Iterator<Item = T>> Iterator for ZipValidity<'a, T, I> type Item = Option<T>;
constructs a new iterator
Returns a new empty PrimitiveArray
.
Returns a new PrimitiveArray
whose all slots are null / None
.
The canonical method to create a PrimitiveArray
out of low-end APIs.
Panics
This function panics iff:
data_type
is not supported by the physical type- The validity is not
None
and its length is different from thevalues
’s length
Returns a slice of this PrimitiveArray
.
Implementation
This operation is O(1)
as it amounts to increase two ref counts.
Panic
This function panics iff offset + length >= self.len()
.
Returns a slice of this PrimitiveArray
.
Implementation
This operation is O(1)
as it amounts to increase two ref counts.
Safety
The caller must ensure that offset + length <= self.len()
.
Sets the validity bitmap on this PrimitiveArray
.
Panics
This function panics iff validity.len() != self.len()
.
The values Buffer
.
Values on null slots are undetermined (they can be anything).
Returns the value at slot i
. Equivalent to self.values()[i]
.
The value on null slots is undetermined (it can be anything).
Returns the element at index i
as T
.
The value on null slots is undetermined (it can be anything).
Safety
Caller must be sure that i < self.len()
Returns a new PrimitiveArray
with a different logical type.
This is O(1)
.
Panics
Panics iff the data_type is not supported for the physical type.
Trait Implementations
The DataType
of the Array
. In combination with Array::as_any
, this can be
used to downcast trait objects (dyn Array
) to concrete arrays. Read more
impl<T> ArrayAdd<PrimitiveArray<T>> for PrimitiveArray<T> where
T: NativeType + Add<Output = T> + NotI128,
This is supported on crate feature compute
only.
impl<T> ArrayAdd<PrimitiveArray<T>> for PrimitiveArray<T> where
T: NativeType + Add<Output = T> + NotI128,
compute
only.impl ArrayAdd<PrimitiveArray<i128>> for PrimitiveArray<i128>
This is supported on crate feature compute
only.
impl ArrayAdd<PrimitiveArray<i128>> for PrimitiveArray<i128>
compute
only.impl<T> ArrayAdd<T> for PrimitiveArray<T> where
T: NativeType + Add<Output = T> + NotI128,
This is supported on crate feature compute
only.
impl<T> ArrayAdd<T> for PrimitiveArray<T> where
T: NativeType + Add<Output = T> + NotI128,
compute
only.impl<T> ArrayCheckedAdd<PrimitiveArray<T>> for PrimitiveArray<T> where
T: NativeType + CheckedAdd<Output = T> + Zero + NotI128,
This is supported on crate feature compute
only.
impl<T> ArrayCheckedAdd<PrimitiveArray<T>> for PrimitiveArray<T> where
T: NativeType + CheckedAdd<Output = T> + Zero + NotI128,
compute
only.type Output = Self
impl ArrayCheckedAdd<PrimitiveArray<i128>> for PrimitiveArray<i128>
This is supported on crate feature compute
only.
impl ArrayCheckedAdd<PrimitiveArray<i128>> for PrimitiveArray<i128>
compute
only.type Output = Self
impl<T> ArrayCheckedAdd<T> for PrimitiveArray<T> where
T: NativeType + CheckedAdd<Output = T> + Zero + NotI128,
This is supported on crate feature compute
only.
impl<T> ArrayCheckedAdd<T> for PrimitiveArray<T> where
T: NativeType + CheckedAdd<Output = T> + Zero + NotI128,
compute
only.impl<T> ArrayCheckedDiv<PrimitiveArray<T>> for PrimitiveArray<T> where
T: NativeType + CheckedDiv<Output = T> + Zero + NotI128,
This is supported on crate feature compute
only.
impl<T> ArrayCheckedDiv<PrimitiveArray<T>> for PrimitiveArray<T> where
T: NativeType + CheckedDiv<Output = T> + Zero + NotI128,
compute
only.type Output = Self
impl ArrayCheckedDiv<PrimitiveArray<i128>> for PrimitiveArray<i128>
This is supported on crate feature compute
only.
impl ArrayCheckedDiv<PrimitiveArray<i128>> for PrimitiveArray<i128>
compute
only.type Output = Self
impl<T> ArrayCheckedDiv<T> for PrimitiveArray<T> where
T: NativeType + CheckedDiv<Output = T> + Zero + NotI128,
This is supported on crate feature compute
only.
impl<T> ArrayCheckedDiv<T> for PrimitiveArray<T> where
T: NativeType + CheckedDiv<Output = T> + Zero + NotI128,
compute
only.impl<T> ArrayCheckedMul<PrimitiveArray<T>> for PrimitiveArray<T> where
T: NativeType + CheckedMul<Output = T> + Zero + NotI128,
This is supported on crate feature compute
only.
impl<T> ArrayCheckedMul<PrimitiveArray<T>> for PrimitiveArray<T> where
T: NativeType + CheckedMul<Output = T> + Zero + NotI128,
compute
only.type Output = Self
impl ArrayCheckedMul<PrimitiveArray<i128>> for PrimitiveArray<i128>
This is supported on crate feature compute
only.
impl ArrayCheckedMul<PrimitiveArray<i128>> for PrimitiveArray<i128>
compute
only.type Output = Self
impl<T> ArrayCheckedMul<T> for PrimitiveArray<T> where
T: NativeType + CheckedMul<Output = T> + Zero + NotI128,
This is supported on crate feature compute
only.
impl<T> ArrayCheckedMul<T> for PrimitiveArray<T> where
T: NativeType + CheckedMul<Output = T> + Zero + NotI128,
compute
only.impl<T> ArrayCheckedRem<PrimitiveArray<T>> for PrimitiveArray<T> where
T: NativeType + CheckedRem<Output = T> + Zero + NotI128,
This is supported on crate feature compute
only.
impl<T> ArrayCheckedRem<PrimitiveArray<T>> for PrimitiveArray<T> where
T: NativeType + CheckedRem<Output = T> + Zero + NotI128,
compute
only.type Output = Self
impl<T> ArrayCheckedRem<T> for PrimitiveArray<T> where
T: NativeType + CheckedRem<Output = T> + Zero + NotI128,
This is supported on crate feature compute
only.
impl<T> ArrayCheckedRem<T> for PrimitiveArray<T> where
T: NativeType + CheckedRem<Output = T> + Zero + NotI128,
compute
only.impl<T> ArrayCheckedSub<PrimitiveArray<T>> for PrimitiveArray<T> where
T: NativeType + CheckedSub<Output = T> + Zero + NotI128,
This is supported on crate feature compute
only.
impl<T> ArrayCheckedSub<PrimitiveArray<T>> for PrimitiveArray<T> where
T: NativeType + CheckedSub<Output = T> + Zero + NotI128,
compute
only.type Output = Self
impl ArrayCheckedSub<PrimitiveArray<i128>> for PrimitiveArray<i128>
This is supported on crate feature compute
only.
impl ArrayCheckedSub<PrimitiveArray<i128>> for PrimitiveArray<i128>
compute
only.type Output = Self
impl<T> ArrayCheckedSub<T> for PrimitiveArray<T> where
T: NativeType + CheckedSub<Output = T> + Zero + NotI128,
This is supported on crate feature compute
only.
impl<T> ArrayCheckedSub<T> for PrimitiveArray<T> where
T: NativeType + CheckedSub<Output = T> + Zero + NotI128,
compute
only.impl<T> ArrayDiv<PrimitiveArray<T>> for PrimitiveArray<T> where
T: NativeType + Div<Output = T> + NotI128,
This is supported on crate feature compute
only.
impl<T> ArrayDiv<PrimitiveArray<T>> for PrimitiveArray<T> where
T: NativeType + Div<Output = T> + NotI128,
compute
only.impl ArrayDiv<PrimitiveArray<i128>> for PrimitiveArray<i128>
This is supported on crate feature compute
only.
impl ArrayDiv<PrimitiveArray<i128>> for PrimitiveArray<i128>
compute
only.impl<T> ArrayDiv<T> for PrimitiveArray<T> where
T: NativeType + Div<Output = T> + NotI128 + NumCast,
This is supported on crate feature compute
only.
impl<T> ArrayDiv<T> for PrimitiveArray<T> where
T: NativeType + Div<Output = T> + NotI128 + NumCast,
compute
only.impl<T> ArrayMul<PrimitiveArray<T>> for PrimitiveArray<T> where
T: NativeType + Mul<Output = T> + NotI128,
This is supported on crate feature compute
only.
impl<T> ArrayMul<PrimitiveArray<T>> for PrimitiveArray<T> where
T: NativeType + Mul<Output = T> + NotI128,
compute
only.impl ArrayMul<PrimitiveArray<i128>> for PrimitiveArray<i128>
This is supported on crate feature compute
only.
impl ArrayMul<PrimitiveArray<i128>> for PrimitiveArray<i128>
compute
only.impl<T> ArrayMul<T> for PrimitiveArray<T> where
T: NativeType + Mul<Output = T> + NotI128,
This is supported on crate feature compute
only.
impl<T> ArrayMul<T> for PrimitiveArray<T> where
T: NativeType + Mul<Output = T> + NotI128,
compute
only.impl<T> ArrayOverflowingAdd<PrimitiveArray<T>> for PrimitiveArray<T> where
T: NativeType + OverflowingAdd<Output = T> + NotI128,
This is supported on crate feature compute
only.
impl<T> ArrayOverflowingAdd<PrimitiveArray<T>> for PrimitiveArray<T> where
T: NativeType + OverflowingAdd<Output = T> + NotI128,
compute
only.type Output = Self
impl<T> ArrayOverflowingAdd<T> for PrimitiveArray<T> where
T: NativeType + OverflowingAdd<Output = T> + NotI128,
This is supported on crate feature compute
only.
impl<T> ArrayOverflowingAdd<T> for PrimitiveArray<T> where
T: NativeType + OverflowingAdd<Output = T> + NotI128,
compute
only.impl<T> ArrayOverflowingMul<PrimitiveArray<T>> for PrimitiveArray<T> where
T: NativeType + OverflowingMul<Output = T> + NotI128,
This is supported on crate feature compute
only.
impl<T> ArrayOverflowingMul<PrimitiveArray<T>> for PrimitiveArray<T> where
T: NativeType + OverflowingMul<Output = T> + NotI128,
compute
only.type Output = Self
impl<T> ArrayOverflowingMul<T> for PrimitiveArray<T> where
T: NativeType + OverflowingMul<Output = T> + NotI128,
This is supported on crate feature compute
only.
impl<T> ArrayOverflowingMul<T> for PrimitiveArray<T> where
T: NativeType + OverflowingMul<Output = T> + NotI128,
compute
only.impl<T> ArrayOverflowingSub<PrimitiveArray<T>> for PrimitiveArray<T> where
T: NativeType + OverflowingSub<Output = T>,
This is supported on crate feature compute
only.
impl<T> ArrayOverflowingSub<PrimitiveArray<T>> for PrimitiveArray<T> where
T: NativeType + OverflowingSub<Output = T>,
compute
only.type Output = Self
impl<T> ArrayOverflowingSub<T> for PrimitiveArray<T> where
T: NativeType + OverflowingSub<Output = T> + NotI128,
This is supported on crate feature compute
only.
impl<T> ArrayOverflowingSub<T> for PrimitiveArray<T> where
T: NativeType + OverflowingSub<Output = T> + NotI128,
compute
only.impl<T> ArrayRem<PrimitiveArray<T>> for PrimitiveArray<T> where
T: NativeType + Rem<Output = T> + NotI128,
This is supported on crate feature compute
only.
impl<T> ArrayRem<PrimitiveArray<T>> for PrimitiveArray<T> where
T: NativeType + Rem<Output = T> + NotI128,
compute
only.impl<T> ArrayRem<T> for PrimitiveArray<T> where
T: NativeType + Rem<Output = T> + NotI128 + NumCast,
This is supported on crate feature compute
only.
impl<T> ArrayRem<T> for PrimitiveArray<T> where
T: NativeType + Rem<Output = T> + NotI128 + NumCast,
compute
only.impl<T> ArraySaturatingAdd<PrimitiveArray<T>> for PrimitiveArray<T> where
T: NativeType + SaturatingAdd<Output = T> + NotI128,
This is supported on crate feature compute
only.
impl<T> ArraySaturatingAdd<PrimitiveArray<T>> for PrimitiveArray<T> where
T: NativeType + SaturatingAdd<Output = T> + NotI128,
compute
only.type Output = Self
impl ArraySaturatingAdd<PrimitiveArray<i128>> for PrimitiveArray<i128>
This is supported on crate feature compute
only.
impl ArraySaturatingAdd<PrimitiveArray<i128>> for PrimitiveArray<i128>
compute
only.type Output = Self
impl<T> ArraySaturatingAdd<T> for PrimitiveArray<T> where
T: NativeType + SaturatingAdd<Output = T> + NotI128,
This is supported on crate feature compute
only.
impl<T> ArraySaturatingAdd<T> for PrimitiveArray<T> where
T: NativeType + SaturatingAdd<Output = T> + NotI128,
compute
only.impl<T> ArraySaturatingMul<PrimitiveArray<T>> for PrimitiveArray<T> where
T: NativeType + SaturatingMul<Output = T> + NotI128,
This is supported on crate feature compute
only.
impl<T> ArraySaturatingMul<PrimitiveArray<T>> for PrimitiveArray<T> where
T: NativeType + SaturatingMul<Output = T> + NotI128,
compute
only.type Output = Self
impl ArraySaturatingMul<PrimitiveArray<i128>> for PrimitiveArray<i128>
This is supported on crate feature compute
only.
impl ArraySaturatingMul<PrimitiveArray<i128>> for PrimitiveArray<i128>
compute
only.type Output = Self
impl<T> ArraySaturatingMul<T> for PrimitiveArray<T> where
T: NativeType + SaturatingMul<Output = T> + NotI128,
This is supported on crate feature compute
only.
impl<T> ArraySaturatingMul<T> for PrimitiveArray<T> where
T: NativeType + SaturatingMul<Output = T> + NotI128,
compute
only.impl<T> ArraySaturatingSub<PrimitiveArray<T>> for PrimitiveArray<T> where
T: NativeType + SaturatingSub<Output = T> + NotI128,
This is supported on crate feature compute
only.
impl<T> ArraySaturatingSub<PrimitiveArray<T>> for PrimitiveArray<T> where
T: NativeType + SaturatingSub<Output = T> + NotI128,
compute
only.type Output = Self
impl ArraySaturatingSub<PrimitiveArray<i128>> for PrimitiveArray<i128>
This is supported on crate feature compute
only.
impl ArraySaturatingSub<PrimitiveArray<i128>> for PrimitiveArray<i128>
compute
only.type Output = Self
impl<T> ArraySaturatingSub<T> for PrimitiveArray<T> where
T: NativeType + SaturatingSub<Output = T> + NotI128,
This is supported on crate feature compute
only.
impl<T> ArraySaturatingSub<T> for PrimitiveArray<T> where
T: NativeType + SaturatingSub<Output = T> + NotI128,
compute
only.impl<T> ArraySub<PrimitiveArray<T>> for PrimitiveArray<T> where
T: NativeType + Sub<Output = T> + NotI128,
This is supported on crate feature compute
only.
impl<T> ArraySub<PrimitiveArray<T>> for PrimitiveArray<T> where
T: NativeType + Sub<Output = T> + NotI128,
compute
only.impl ArraySub<PrimitiveArray<i128>> for PrimitiveArray<i128>
This is supported on crate feature compute
only.
impl ArraySub<PrimitiveArray<i128>> for PrimitiveArray<i128>
compute
only.impl<T> ArraySub<T> for PrimitiveArray<T> where
T: NativeType + Sub<Output = T> + NotI128,
This is supported on crate feature compute
only.
impl<T> ArraySub<T> for PrimitiveArray<T> where
T: NativeType + Sub<Output = T> + NotI128,
compute
only.Performs the conversion.
Performs the conversion.
Convert itself from FFI. Read more
impl<T: NativeType + NaturalDataType, Ptr: Borrow<Option<T>>> FromIterator<Ptr> for PrimitiveArray<T>
impl<T: NativeType + NaturalDataType, Ptr: Borrow<Option<T>>> FromIterator<Ptr> for PrimitiveArray<T>
Creates a value from an iterator. Read more
Auto Trait Implementations
impl<T> RefUnwindSafe for PrimitiveArray<T> where
T: RefUnwindSafe,
impl<T> Send for PrimitiveArray<T>
impl<T> Sync for PrimitiveArray<T>
impl<T> Unpin for PrimitiveArray<T>
impl<T> UnwindSafe for PrimitiveArray<T> where
T: RefUnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more