Struct arrow2::array::MutablePrimitiveArray [−][src]
pub struct MutablePrimitiveArray<T: NativeType> { /* fields omitted */ }
Expand description
The Arrow’s equivalent to Vec<Option<T>>
where T
is byte-size (e.g. i32
).
Converting a MutablePrimitiveArray
into a PrimitiveArray
is O(1)
.
Implementations
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>;
Returns an iterator over Option<T>
Returns an iterator of bool
Creates a new empty MutablePrimitiveArray
.
Creates a new MutablePrimitiveArray
with a capacity.
pub fn from_data(
data_type: DataType,
values: MutableBuffer<T>,
validity: Option<MutableBitmap>
) -> Self
pub fn from_data(
data_type: DataType,
values: MutableBuffer<T>,
validity: Option<MutableBitmap>
) -> Self
Create a MutablePrimitiveArray
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
Extract the low-end APIs from the MutablePrimitiveArray
.
Creates a new MutablePrimitiveArray
from a capacity and DataType
.
pub fn extend_trusted_len<P, I>(&mut self, iterator: I) where
P: Borrow<T>,
I: TrustedLen<Item = Option<P>>,
pub fn extend_trusted_len<P, I>(&mut self, iterator: I) where
P: Borrow<T>,
I: TrustedLen<Item = Option<P>>,
Extends the MutablePrimitiveArray
from an iterator of trusted len.
pub unsafe fn extend_trusted_len_unchecked<P, I>(&mut self, iterator: I) where
P: Borrow<T>,
I: Iterator<Item = Option<P>>,
pub unsafe fn extend_trusted_len_unchecked<P, I>(&mut self, iterator: I) where
P: Borrow<T>,
I: Iterator<Item = Option<P>>,
Extends the MutablePrimitiveArray
from an iterator of trusted len.
Safety
The iterator must be trusted len.
Extends the MutablePrimitiveArray
from an iterator of values of trusted len.
This differs from extend_trusted_len
which accepts in iterator of optional values.
pub unsafe fn extend_trusted_len_values_unchecked<I>(&mut self, iterator: I) where
I: Iterator<Item = T>,
pub unsafe fn extend_trusted_len_values_unchecked<I>(&mut self, iterator: I) where
I: Iterator<Item = T>,
Extends the MutablePrimitiveArray
from an iterator of values of trusted len.
This differs from extend_trusted_len_unchecked
which accepts in iterator of optional values.
Safety
The iterator must be trusted len.
Extends the MutablePrimitiveArray
from a slice
Changes the arrays’ DataType
, returning a new MutablePrimitiveArray
.
Use to change the logical type without changing the corresponding physical Type.
Implementation
This operation is O(1)
.
Shrinks the capacity of the MutablePrimitiveArray
to fit its current length.
Accessors
Returns its values.
Returns a mutable slice of values.
Setters
Sets position index
to value
.
Note that if it is the first time a null appears in this array,
this initializes the validity bitmap (O(N)
).
Panic
Panics iff index is larger than self.len()
.
Creates a MutablePrimitiveArray
from a slice of values.
pub unsafe fn from_trusted_len_iter_unchecked<I, P>(iterator: I) -> Self where
P: Borrow<T>,
I: Iterator<Item = Option<P>>,
pub unsafe fn from_trusted_len_iter_unchecked<I, P>(iterator: I) -> Self where
P: Borrow<T>,
I: Iterator<Item = Option<P>>,
Creates a MutablePrimitiveArray
from an iterator of trusted length.
Safety
The iterator must be TrustedLen
.
I.e. size_hint().1
correctly reports its length.
pub fn from_trusted_len_iter<I, P>(iterator: I) -> Self where
P: Borrow<T>,
I: TrustedLen<Item = Option<P>>,
pub fn from_trusted_len_iter<I, P>(iterator: I) -> Self where
P: Borrow<T>,
I: TrustedLen<Item = Option<P>>,
Creates a MutablePrimitiveArray
from a TrustedLen
.
pub unsafe fn try_from_trusted_len_iter_unchecked<E, I, P>(
iter: I
) -> Result<Self, E> where
P: Borrow<T>,
I: IntoIterator<Item = Result<Option<P>, E>>,
pub unsafe fn try_from_trusted_len_iter_unchecked<E, I, P>(
iter: I
) -> Result<Self, E> where
P: Borrow<T>,
I: IntoIterator<Item = Result<Option<P>, E>>,
Creates a MutablePrimitiveArray
from an fallible iterator of trusted length.
Safety
The iterator must be TrustedLen
.
I.e. that size_hint().1
correctly reports its length.
pub fn try_from_trusted_len_iter<E, I, P>(iterator: I) -> Result<Self, E> where
P: Borrow<T>,
I: TrustedLen<Item = Result<Option<P>, E>>,
pub fn try_from_trusted_len_iter<E, I, P>(iterator: I) -> Result<Self, E> where
P: Borrow<T>,
I: TrustedLen<Item = Result<Option<P>, E>>,
Creates a MutablePrimitiveArray
from an fallible iterator of trusted length.
Creates a new MutablePrimitiveArray
out an iterator over values
Creates a new MutablePrimitiveArray
from an iterator over values
Safety
The iterator must be TrustedLen
.
I.e. that size_hint().1
correctly reports its length.
Trait Implementations
Extends a collection with the contents of an iterator. Read more
extend_one
)Extends a collection with exactly one element.
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Performs the conversion.
impl<T: NativeType + NaturalDataType, P: AsRef<[Option<T>]>> From<P> for MutablePrimitiveArray<T>
impl<T: NativeType + NaturalDataType, P: AsRef<[Option<T>]>> From<P> for MutablePrimitiveArray<T>
impl<T: NativeType + NaturalDataType, Ptr: Borrow<Option<T>>> FromIterator<Ptr> for MutablePrimitiveArray<T>
impl<T: NativeType + NaturalDataType, Ptr: Borrow<Option<T>>> FromIterator<Ptr> for MutablePrimitiveArray<T>
Creates a value from an iterator. Read more
The optional validity of the array.
Convert itself to an (immutable) atomically reference counted Array
.
Convert to mutable Any
, to enable dynamic casting.
Shrink the array to fit its length.
This is infalible and is implemented for consistency with all other types