Struct arrow2::array::MutablePrimitiveArray [−][src]
pub struct MutablePrimitiveArray<T: NativeType> { /* fields omitted */ }
Expand description
The mutable version of PrimitiveArray
. See MutableArray
for more details.
Implementations
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.
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)
.
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 to mutable Any
, to enable dynamic casting.
This is infalible and is implemented for consistency with all other types