pub struct MutablePrimitiveArray<T> where
T: NativeType, { /* private fields */ }
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
sourceimpl<'a, T> MutablePrimitiveArray<T> where
T: NativeType,
impl<'a, T> MutablePrimitiveArray<T> where
T: NativeType,
sourcepub fn iter(&'a self) -> ZipValidity<'a, &'a T, Iter<'a, T>>ⓘNotable traits for ZipValidity<'a, T, I>impl<'a, T, I> Iterator for ZipValidity<'a, T, I> where
I: Iterator<Item = T>, 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 for ZipValidity<'a, T, I> where
I: Iterator<Item = T>, type Item = Option<T>;
I: Iterator<Item = T>, type Item = Option<T>;
Returns an iterator over Option<T>
sourcepub fn values_iter(&'a self) -> Iter<'a, T>
pub fn values_iter(&'a self) -> Iter<'a, T>
Returns an iterator of bool
sourceimpl<T> MutablePrimitiveArray<T> where
T: NativeType,
impl<T> MutablePrimitiveArray<T> where
T: NativeType,
sourcepub fn new() -> MutablePrimitiveArray<T>
pub fn new() -> MutablePrimitiveArray<T>
Creates a new empty MutablePrimitiveArray
.
sourcepub fn with_capacity(capacity: usize) -> MutablePrimitiveArray<T>
pub fn with_capacity(capacity: usize) -> MutablePrimitiveArray<T>
Creates a new MutablePrimitiveArray
with a capacity.
sourcepub fn from_data(
data_type: DataType,
values: Vec<T, Global>,
validity: Option<MutableBitmap>
) -> MutablePrimitiveArray<T>
pub fn from_data(
data_type: DataType,
values: Vec<T, Global>,
validity: Option<MutableBitmap>
) -> MutablePrimitiveArray<T>
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
sourcepub fn into_data(self) -> (DataType, Vec<T, Global>, Option<MutableBitmap>)
pub fn into_data(self) -> (DataType, Vec<T, Global>, Option<MutableBitmap>)
Extract the low-end APIs from the MutablePrimitiveArray
.
sourceimpl<T> MutablePrimitiveArray<T> where
T: NativeType,
impl<T> MutablePrimitiveArray<T> where
T: NativeType,
sourcepub fn with_capacity_from(
capacity: usize,
data_type: DataType
) -> MutablePrimitiveArray<T>
pub fn with_capacity_from(
capacity: usize,
data_type: DataType
) -> MutablePrimitiveArray<T>
Creates a new MutablePrimitiveArray
from a capacity and DataType
.
sourcepub fn extend_constant(&mut self, additional: usize, value: Option<T>)
pub fn extend_constant(&mut self, additional: usize, value: Option<T>)
Extends the MutablePrimitiveArray
with a constant
sourcepub 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.
sourcepub 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.
sourcepub fn extend_trusted_len_values<I>(&mut self, iterator: I) where
I: TrustedLen<Item = T>,
pub fn extend_trusted_len_values<I>(&mut self, iterator: I) where
I: TrustedLen<Item = T>,
Extends the MutablePrimitiveArray
from an iterator of values of trusted len.
This differs from extend_trusted_len
which accepts in iterator of optional values.
sourcepub 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.
sourcepub fn extend_from_slice(&mut self, items: &[T])
pub fn extend_from_slice(&mut self, items: &[T])
Extends the MutablePrimitiveArray
from a slice
sourcepub fn to(self, data_type: DataType) -> MutablePrimitiveArray<T>
pub fn to(self, data_type: DataType) -> MutablePrimitiveArray<T>
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)
.
sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Shrinks the capacity of the MutablePrimitiveArray
to fit its current length.
sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Returns the capacity of this MutablePrimitiveArray
.
sourceimpl<T> MutablePrimitiveArray<T> where
T: NativeType,
impl<T> MutablePrimitiveArray<T> where
T: NativeType,
Accessors
sourceimpl<T> MutablePrimitiveArray<T> where
T: NativeType,
impl<T> MutablePrimitiveArray<T> where
T: NativeType,
Setters
sourcepub fn set(&mut self, index: usize, value: Option<T>)
pub fn set(&mut self, index: usize, value: Option<T>)
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()
.
sourcepub unsafe fn set_unchecked(&mut self, index: usize, value: Option<T>)
pub unsafe fn set_unchecked(&mut self, index: usize, value: Option<T>)
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)
).
Safety
Caller must ensure index < self.len()
sourcepub fn set_validity(&mut self, validity: Option<MutableBitmap>)
pub fn set_validity(&mut self, validity: Option<MutableBitmap>)
sourcepub fn set_values(&mut self, values: Vec<T, Global>)
pub fn set_values(&mut self, values: Vec<T, Global>)
sourceimpl<T> MutablePrimitiveArray<T> where
T: NativeType,
impl<T> MutablePrimitiveArray<T> where
T: NativeType,
sourcepub fn from_slice<P>(slice: P) -> MutablePrimitiveArray<T> where
P: AsRef<[T]>,
pub fn from_slice<P>(slice: P) -> MutablePrimitiveArray<T> where
P: AsRef<[T]>,
Creates a MutablePrimitiveArray
from a slice of values.
sourcepub unsafe fn from_trusted_len_iter_unchecked<I, P>(
iterator: I
) -> MutablePrimitiveArray<T> where
P: Borrow<T>,
I: Iterator<Item = Option<P>>,
pub unsafe fn from_trusted_len_iter_unchecked<I, P>(
iterator: I
) -> MutablePrimitiveArray<T> 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.
sourcepub fn from_trusted_len_iter<I, P>(iterator: I) -> MutablePrimitiveArray<T> where
P: Borrow<T>,
I: TrustedLen<Item = Option<P>>,
pub fn from_trusted_len_iter<I, P>(iterator: I) -> MutablePrimitiveArray<T> where
P: Borrow<T>,
I: TrustedLen<Item = Option<P>>,
Creates a MutablePrimitiveArray
from a TrustedLen
.
sourcepub unsafe fn try_from_trusted_len_iter_unchecked<E, I, P>(
iter: I
) -> Result<MutablePrimitiveArray<T>, 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<MutablePrimitiveArray<T>, 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.
sourcepub fn try_from_trusted_len_iter<E, I, P>(
iterator: I
) -> Result<MutablePrimitiveArray<T>, 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<MutablePrimitiveArray<T>, E> where
P: Borrow<T>,
I: TrustedLen<Item = Result<Option<P>, E>>,
Creates a MutablePrimitiveArray
from an fallible iterator of trusted length.
sourcepub fn from_trusted_len_values_iter<I>(iter: I) -> MutablePrimitiveArray<T> where
I: TrustedLen<Item = T>,
pub fn from_trusted_len_values_iter<I>(iter: I) -> MutablePrimitiveArray<T> where
I: TrustedLen<Item = T>,
Creates a new MutablePrimitiveArray
out an iterator over values
sourcepub fn from_vec(values: Vec<T, Global>) -> MutablePrimitiveArray<T>
pub fn from_vec(values: Vec<T, Global>) -> MutablePrimitiveArray<T>
Creates a (non-null) MutablePrimitiveArray
from a vector of values.
This does not have memcopy and is the fastest way to create a PrimitiveArray
.
sourcepub unsafe fn from_trusted_len_values_iter_unchecked<I>(
iter: I
) -> MutablePrimitiveArray<T> where
I: Iterator<Item = T>,
pub unsafe fn from_trusted_len_values_iter_unchecked<I>(
iter: I
) -> MutablePrimitiveArray<T> where
I: Iterator<Item = T>,
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
sourceimpl<T> Debug for MutablePrimitiveArray<T> where
T: Debug + NativeType,
impl<T> Debug for MutablePrimitiveArray<T> where
T: Debug + NativeType,
sourceimpl<T> Default for MutablePrimitiveArray<T> where
T: NativeType,
impl<T> Default for MutablePrimitiveArray<T> where
T: NativeType,
sourcefn default() -> MutablePrimitiveArray<T>
fn default() -> MutablePrimitiveArray<T>
Returns the “default value” for a type. Read more
sourceimpl<T> Extend<Option<T>> for MutablePrimitiveArray<T> where
T: NativeType,
impl<T> Extend<Option<T>> for MutablePrimitiveArray<T> where
T: NativeType,
sourcefn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = Option<T>>,
fn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = Option<T>>,
Extends a collection with the contents of an iterator. Read more
sourcefn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Extends a collection with exactly one element.
sourcefn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
sourceimpl<T> From<DataType> for MutablePrimitiveArray<T> where
T: NativeType,
impl<T> From<DataType> for MutablePrimitiveArray<T> where
T: NativeType,
sourcefn from(data_type: DataType) -> MutablePrimitiveArray<T>
fn from(data_type: DataType) -> MutablePrimitiveArray<T>
Performs the conversion.
sourceimpl<T> From<MutablePrimitiveArray<T>> for PrimitiveArray<T> where
T: NativeType,
impl<T> From<MutablePrimitiveArray<T>> for PrimitiveArray<T> where
T: NativeType,
sourcefn from(other: MutablePrimitiveArray<T>) -> PrimitiveArray<T>
fn from(other: MutablePrimitiveArray<T>) -> PrimitiveArray<T>
Performs the conversion.
sourceimpl<T, P> From<P> for MutablePrimitiveArray<T> where
T: NativeType,
P: AsRef<[Option<T>]>,
impl<T, P> From<P> for MutablePrimitiveArray<T> where
T: NativeType,
P: AsRef<[Option<T>]>,
sourcefn from(slice: P) -> MutablePrimitiveArray<T>
fn from(slice: P) -> MutablePrimitiveArray<T>
Performs the conversion.
sourceimpl<T, Ptr> FromIterator<Ptr> for MutablePrimitiveArray<T> where
T: NativeType,
Ptr: Borrow<Option<T>>,
impl<T, Ptr> FromIterator<Ptr> for MutablePrimitiveArray<T> where
T: NativeType,
Ptr: Borrow<Option<T>>,
sourcefn from_iter<I>(iter: I) -> MutablePrimitiveArray<T> where
I: IntoIterator<Item = Ptr>,
fn from_iter<I>(iter: I) -> MutablePrimitiveArray<T> where
I: IntoIterator<Item = Ptr>,
Creates a value from an iterator. Read more
sourceimpl<T> MutableArray for MutablePrimitiveArray<T> where
T: NativeType,
impl<T> MutableArray for MutablePrimitiveArray<T> where
T: NativeType,
sourcefn validity(&self) -> Option<&MutableBitmap>
fn validity(&self) -> Option<&MutableBitmap>
The optional validity of the array.
sourcefn as_box(&mut self) -> Box<dyn Array + 'static, Global>
fn as_box(&mut self) -> Box<dyn Array + 'static, Global>
Convert itself to an (immutable) [‘Array’].
sourcefn as_arc(&mut self) -> Arc<dyn Array + 'static>
fn as_arc(&mut self) -> Arc<dyn Array + 'static>
Convert itself to an (immutable) atomically reference counted Array
.
sourcefn as_mut_any(&mut self) -> &mut (dyn Any + 'static)
fn as_mut_any(&mut self) -> &mut (dyn Any + 'static)
Convert to mutable Any
, to enable dynamic casting.
sourcefn shrink_to_fit(&mut self)
fn shrink_to_fit(&mut self)
Shrink the array to fit its length.
sourceimpl<T> PartialEq<MutablePrimitiveArray<T>> for MutablePrimitiveArray<T> where
T: NativeType,
impl<T> PartialEq<MutablePrimitiveArray<T>> for MutablePrimitiveArray<T> where
T: NativeType,
sourceimpl<T> TryExtend<Option<T>> for MutablePrimitiveArray<T> where
T: NativeType,
impl<T> TryExtend<Option<T>> for MutablePrimitiveArray<T> where
T: NativeType,
sourcefn try_extend<I>(&mut self, iter: I) -> Result<(), ArrowError> where
I: IntoIterator<Item = Option<T>>,
fn try_extend<I>(&mut self, iter: I) -> Result<(), ArrowError> where
I: IntoIterator<Item = Option<T>>,
This is infalible and is implemented for consistency with all other types
sourceimpl<T> TryPush<Option<T>> for MutablePrimitiveArray<T> where
T: NativeType,
impl<T> TryPush<Option<T>> for MutablePrimitiveArray<T> where
T: NativeType,
Auto Trait Implementations
impl<T> RefUnwindSafe for MutablePrimitiveArray<T> where
T: RefUnwindSafe,
impl<T> Send for MutablePrimitiveArray<T>
impl<T> Sync for MutablePrimitiveArray<T>
impl<T> Unpin for MutablePrimitiveArray<T> where
T: Unpin,
impl<T> UnwindSafe for MutablePrimitiveArray<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more