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(
dtype: ArrowDataType,
values: Vec<u8>,
validity: Option<MutableBitmap>,
) -> PolarsResult<Self>
pub fn try_new( dtype: ArrowDataType, values: Vec<u8>, validity: Option<MutableBitmap>, ) -> PolarsResult<Self>
Creates a new MutableFixedSizeBinaryArray
.
§Errors
This function returns an error iff:
- The
dtype
’s physical type is notcrate::datatypes::PhysicalType::FixedSizeBinary
- The length of
values
is not a multiple ofsize
indtype
- 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>) -> PolarsResult<()>
pub fn try_push<P: AsRef<[u8]>>(&mut self, value: Option<P>) -> PolarsResult<()>
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,
) -> PolarsResult<Self>
pub fn try_from_iter<P: AsRef<[u8]>, I: IntoIterator<Item = Option<P>>>( iter: I, size: usize, ) -> PolarsResult<Self>
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 dtype(&self) -> &ArrowDataType
fn dtype(&self) -> &ArrowDataType
ArrowDataType
of the 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 TryExtendFromSelf for MutableFixedSizeBinaryArray
impl TryExtendFromSelf for MutableFixedSizeBinaryArray
Source§fn try_extend_from_self(&mut self, other: &Self) -> PolarsResult<()>
fn try_extend_from_self(&mut self, other: &Self) -> PolarsResult<()>
other
, failing only on overflow.Auto Trait Implementations§
impl Freeze for MutableFixedSizeBinaryArray
impl RefUnwindSafe for MutableFixedSizeBinaryArray
impl Send for MutableFixedSizeBinaryArray
impl Sync for MutableFixedSizeBinaryArray
impl Unpin for MutableFixedSizeBinaryArray
impl UnwindSafe for MutableFixedSizeBinaryArray
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more