Struct arrow2::array::MutableFixedSizeBinaryArray
source · pub struct MutableFixedSizeBinaryArray { /* private fields */ }
Expand description
The Arrow’s equivalent to a mutable Vec<Option<[u8; size]>>
.
Converting a MutableFixedSizeBinaryArray
into a FixedSizeBinaryArray
is O(1)
.
§Implementation
This struct does not allocate a validity until one is required (i.e. push a null to it).
Implementations§
source§impl<'a> MutableFixedSizeBinaryArray
impl<'a> MutableFixedSizeBinaryArray
sourcepub fn iter(
&'a self
) -> ZipValidity<&'a [u8], ChunksExact<'a, u8>, BitmapIter<'a>> ⓘ
pub fn iter( &'a self ) -> ZipValidity<&'a [u8], ChunksExact<'a, u8>, BitmapIter<'a>> ⓘ
constructs a new iterator
sourcepub fn iter_values(&'a self) -> ChunksExact<'a, u8>
pub fn iter_values(&'a self) -> ChunksExact<'a, u8>
Returns iterator over the values of MutableFixedSizeBinaryArray
source§impl MutableFixedSizeBinaryArray
impl MutableFixedSizeBinaryArray
sourcepub fn try_new(
data_type: DataType,
values: Vec<u8>,
validity: Option<MutableBitmap>
) -> Result<Self, Error>
pub fn try_new( data_type: DataType, values: Vec<u8>, validity: Option<MutableBitmap> ) -> Result<Self, Error>
Creates a new MutableFixedSizeBinaryArray
.
§Errors
This function returns an error iff:
- The
data_type
’s physical type is notcrate::datatypes::PhysicalType::FixedSizeBinary
- The length of
values
is not a multiple ofsize
indata_type
- the validity’s length is not equal to
values.len() / size
.
sourcepub fn new(size: usize) -> Self
pub fn new(size: usize) -> Self
Creates a new empty MutableFixedSizeBinaryArray
.
sourcepub fn with_capacity(size: usize, capacity: usize) -> Self
pub fn with_capacity(size: usize, capacity: usize) -> Self
Creates a new MutableFixedSizeBinaryArray
with capacity for capacity
entries.
sourcepub fn from<const N: usize, P: AsRef<[Option<[u8; N]>]>>(slice: P) -> Self
pub fn from<const N: usize, P: AsRef<[Option<[u8; N]>]>>(slice: P) -> Self
Creates a new MutableFixedSizeBinaryArray
from a slice of optional [u8]
.
sourcepub fn try_push<P: AsRef<[u8]>>(
&mut self,
value: Option<P>
) -> Result<(), Error>
pub fn try_push<P: AsRef<[u8]>>( &mut self, value: Option<P> ) -> Result<(), Error>
tries to push a new entry to MutableFixedSizeBinaryArray
.
§Error
Errors iff the size of value
is not equal to its own size.
sourcepub fn push<P: AsRef<[u8]>>(&mut self, value: Option<P>)
pub fn push<P: AsRef<[u8]>>(&mut self, value: Option<P>)
pushes a new entry to MutableFixedSizeBinaryArray
.
§Panics
Panics iff the size of value
is not equal to its own size.
sourcepub fn pop(&mut self) -> Option<Vec<u8>>
pub fn pop(&mut self) -> Option<Vec<u8>>
Pop the last entry from MutableFixedSizeBinaryArray
.
This function returns None
iff this array is empty
sourcepub fn try_from_iter<P: AsRef<[u8]>, I: IntoIterator<Item = Option<P>>>(
iter: I,
size: usize
) -> Result<Self, Error>
pub fn try_from_iter<P: AsRef<[u8]>, I: IntoIterator<Item = Option<P>>>( iter: I, size: usize ) -> Result<Self, Error>
Creates a new MutableFixedSizeBinaryArray
from an iterator of values.
§Errors
Errors iff the size of any of the value
is not equal to its own size.
sourcepub fn size(&self) -> usize
pub fn size(&self) -> usize
returns the (fixed) size of the MutableFixedSizeBinaryArray
.
sourcepub unsafe fn value_unchecked(&self, i: usize) -> &[u8] ⓘ
pub unsafe fn value_unchecked(&self, i: usize) -> &[u8] ⓘ
sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Shrinks the capacity of the MutableFixedSizeBinaryArray
to fit its current length.
Trait Implementations§
source§impl Clone for MutableFixedSizeBinaryArray
impl Clone for MutableFixedSizeBinaryArray
source§fn clone(&self) -> MutableFixedSizeBinaryArray
fn clone(&self) -> MutableFixedSizeBinaryArray
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for MutableFixedSizeBinaryArray
impl Debug for MutableFixedSizeBinaryArray
source§impl From<MutableFixedSizeBinaryArray> for FixedSizeBinaryArray
impl From<MutableFixedSizeBinaryArray> for FixedSizeBinaryArray
source§fn from(other: MutableFixedSizeBinaryArray) -> Self
fn from(other: MutableFixedSizeBinaryArray) -> Self
source§impl<'a> IntoIterator for &'a MutableFixedSizeBinaryArray
impl<'a> IntoIterator for &'a MutableFixedSizeBinaryArray
source§impl MutableArray for MutableFixedSizeBinaryArray
impl MutableArray for MutableFixedSizeBinaryArray
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.