Struct arrow2::array::MutableBinaryValuesArray
source · pub struct MutableBinaryValuesArray<O: Offset> { /* private fields */ }
Expand description
A MutableArray
that builds a BinaryArray
. It differs
from MutableBinaryArray
in that it builds non-null BinaryArray
.
Implementations§
source§impl<O: Offset> MutableBinaryValuesArray<O>
impl<O: Offset> MutableBinaryValuesArray<O>
sourcepub fn new() -> Self
pub fn new() -> Self
Returns an empty MutableBinaryValuesArray
.
sourcepub fn try_new(
data_type: DataType,
offsets: Offsets<O>,
values: Vec<u8>
) -> Result<Self>
pub fn try_new( data_type: DataType, offsets: Offsets<O>, values: Vec<u8> ) -> Result<Self>
Returns a MutableBinaryValuesArray
created from its internal representation.
§Errors
This function returns an error iff:
- The last offset is not equal to the values’ length.
- The
data_type
’scrate::datatypes::PhysicalType
is not equal to eitherBinary
orLargeBinary
.
§Implementation
This function is O(1)
sourcepub fn default_data_type() -> DataType
pub fn default_data_type() -> DataType
Returns the default DataType
of this container: DataType::Utf8
or DataType::LargeUtf8
depending on the generic Offset
.
sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Initializes a new MutableBinaryValuesArray
with a pre-allocated capacity of items.
sourcepub fn with_capacities(capacity: usize, values: usize) -> Self
pub fn with_capacities(capacity: usize, values: usize) -> Self
Initializes a new MutableBinaryValuesArray
with a pre-allocated capacity of items and values.
sourcepub fn reserve(&mut self, additional: usize, additional_values: usize)
pub fn reserve(&mut self, additional: usize, additional_values: usize)
Reserves additional
elements and additional_values
on the values.
sourcepub fn push<T: AsRef<[u8]>>(&mut self, value: T)
pub fn push<T: AsRef<[u8]>>(&mut self, value: T)
Pushes a new item to the array.
§Panic
This operation panics iff the length of all values (in bytes) exceeds O
maximum value.
sourcepub fn pop(&mut self) -> Option<Vec<u8>>
pub fn pop(&mut self) -> Option<Vec<u8>>
Pop the last entry from MutableBinaryValuesArray
.
This function returns None
iff this array is empty.
sourcepub unsafe fn value_unchecked(&self, i: usize) -> &[u8] ⓘ
pub unsafe fn value_unchecked(&self, i: usize) -> &[u8] ⓘ
sourcepub fn iter(&self) -> ArrayValuesIter<'_, Self> ⓘ
pub fn iter(&self) -> ArrayValuesIter<'_, Self> ⓘ
Returns an iterator of &[u8]
sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Shrinks the capacity of the MutableBinaryValuesArray
to fit its current length.
sourcepub fn into_inner(self) -> (DataType, Offsets<O>, Vec<u8>)
pub fn into_inner(self) -> (DataType, Offsets<O>, Vec<u8>)
Extract the low-end APIs from the MutableBinaryValuesArray
.
source§impl<O: Offset> MutableBinaryValuesArray<O>
impl<O: Offset> MutableBinaryValuesArray<O>
sourcepub fn extend_trusted_len<I, P>(&mut self, iterator: I)
pub fn extend_trusted_len<I, P>(&mut self, iterator: I)
Extends the MutableBinaryValuesArray
from a TrustedLen
sourcepub unsafe fn extend_trusted_len_unchecked<I, P>(&mut self, iterator: I)
pub unsafe fn extend_trusted_len_unchecked<I, P>(&mut self, iterator: I)
Extends MutableBinaryValuesArray
from an iterator of trusted len.
§Safety
The iterator must be trusted len.
sourcepub fn from_trusted_len_iter<I, P>(iterator: I) -> Self
pub fn from_trusted_len_iter<I, P>(iterator: I) -> Self
Creates a MutableBinaryValuesArray
from a TrustedLen
sourcepub unsafe fn from_trusted_len_iter_unchecked<I, P>(iterator: I) -> Self
pub unsafe fn from_trusted_len_iter_unchecked<I, P>(iterator: I) -> Self
Returns a new MutableBinaryValuesArray
from an iterator of trusted length.
§Safety
The iterator must be TrustedLen
.
I.e. that size_hint().1
correctly reports its length.
sourcepub fn try_from_iter<P: AsRef<[u8]>, I: IntoIterator<Item = P>>(
iter: I
) -> Result<Self>
pub fn try_from_iter<P: AsRef<[u8]>, I: IntoIterator<Item = P>>( iter: I ) -> Result<Self>
Returns a new MutableBinaryValuesArray
from an iterator.
§Error
This operation errors iff the total length in bytes on the iterator exceeds O
’s maximum value.
(i32::MAX
or i64::MAX
respectively).
Trait Implementations§
source§impl<O: Clone + Offset> Clone for MutableBinaryValuesArray<O>
impl<O: Clone + Offset> Clone for MutableBinaryValuesArray<O>
source§fn clone(&self) -> MutableBinaryValuesArray<O>
fn clone(&self) -> MutableBinaryValuesArray<O>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<O: Offset> Default for MutableBinaryValuesArray<O>
impl<O: Offset> Default for MutableBinaryValuesArray<O>
source§impl<O: Offset, T: AsRef<[u8]>> Extend<T> for MutableBinaryValuesArray<O>
impl<O: Offset, T: AsRef<[u8]>> Extend<T> for MutableBinaryValuesArray<O>
source§fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)source§impl<O: Offset> From<MutableBinaryValuesArray<O>> for BinaryArray<O>
impl<O: Offset> From<MutableBinaryValuesArray<O>> for BinaryArray<O>
source§fn from(other: MutableBinaryValuesArray<O>) -> Self
fn from(other: MutableBinaryValuesArray<O>) -> Self
source§impl<O: Offset> From<MutableBinaryValuesArray<O>> for MutableBinaryArray<O>
impl<O: Offset> From<MutableBinaryValuesArray<O>> for MutableBinaryArray<O>
source§fn from(other: MutableBinaryValuesArray<O>) -> Self
fn from(other: MutableBinaryValuesArray<O>) -> Self
source§impl<O: Offset, P: AsRef<[u8]>> FromIterator<P> for MutableBinaryValuesArray<O>
impl<O: Offset, P: AsRef<[u8]>> FromIterator<P> for MutableBinaryValuesArray<O>
source§fn from_iter<I: IntoIterator<Item = P>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = P>>(iter: I) -> Self
source§impl<'a, O: Offset> IntoIterator for &'a MutableBinaryValuesArray<O>
impl<'a, O: Offset> IntoIterator for &'a MutableBinaryValuesArray<O>
source§impl<O: Offset> MutableArray for MutableBinaryValuesArray<O>
impl<O: Offset> MutableArray for MutableBinaryValuesArray<O>
source§fn validity(&self) -> Option<&MutableBitmap>
fn validity(&self) -> Option<&MutableBitmap>
source§fn as_arc(&mut self) -> Arc<dyn Array>
fn as_arc(&mut self) -> Arc<dyn Array>
Array
.source§fn as_mut_any(&mut self) -> &mut dyn Any
fn as_mut_any(&mut self) -> &mut dyn Any
Any
, to enable dynamic casting.source§fn shrink_to_fit(&mut self)
fn shrink_to_fit(&mut self)
source§impl<O: Offset, T: AsRef<[u8]>> TryExtend<T> for MutableBinaryValuesArray<O>
impl<O: Offset, T: AsRef<[u8]>> TryExtend<T> for MutableBinaryValuesArray<O>
source§fn try_extend<I: IntoIterator<Item = T>>(&mut self, iter: I) -> Result<()>
fn try_extend<I: IntoIterator<Item = T>>(&mut self, iter: I) -> Result<()>
Extend::extend
.