Struct arrow2::array::MutableBooleanArray
source · pub struct MutableBooleanArray { /* private fields */ }
Expand description
The Arrow’s equivalent to Vec<Option<bool>>
, but with 1/16
of its size.
Converting a MutableBooleanArray
into a BooleanArray
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> MutableBooleanArray
impl<'a> MutableBooleanArray
sourcepub fn iter(&'a self) -> ZipValidity<bool, BitmapIter<'a>, BitmapIter<'a>> ⓘ
pub fn iter(&'a self) -> ZipValidity<bool, BitmapIter<'a>, BitmapIter<'a>> ⓘ
Returns an iterator over the optional values of this MutableBooleanArray
.
sourcepub fn values_iter(&'a self) -> BitmapIter<'a> ⓘ
pub fn values_iter(&'a self) -> BitmapIter<'a> ⓘ
Returns an iterator over the values of this MutableBooleanArray
source§impl MutableBooleanArray
impl MutableBooleanArray
sourcepub fn new() -> Self
pub fn new() -> Self
Creates an new empty MutableBooleanArray
.
sourcepub fn try_new(
data_type: DataType,
values: MutableBitmap,
validity: Option<MutableBitmap>
) -> Result<Self, Error>
pub fn try_new( data_type: DataType, values: MutableBitmap, validity: Option<MutableBitmap> ) -> Result<Self, Error>
The canonical method to create a MutableBooleanArray
out of low-end APIs.
§Errors
This function errors iff:
- The validity is not
None
and its length is different fromvalues
’s length - The
data_type
’sPhysicalType
is not equal toPhysicalType::Boolean
.
sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates an new MutableBooleanArray
with a capacity of values.
sourcepub fn push(&mut self, value: Option<bool>)
pub fn push(&mut self, value: Option<bool>)
Pushes a new entry to MutableBooleanArray
.
sourcepub fn pop(&mut self) -> Option<bool>
pub fn pop(&mut self) -> Option<bool>
Pop an entry from MutableBooleanArray
.
Note If the values is empty, this method will return None.
sourcepub fn extend_trusted_len_values<I>(&mut self, iterator: I)where
I: TrustedLen<Item = bool>,
pub fn extend_trusted_len_values<I>(&mut self, iterator: I)where
I: TrustedLen<Item = bool>,
Extends the MutableBooleanArray
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)
pub unsafe fn extend_trusted_len_values_unchecked<I>(&mut self, iterator: I)
Extends the MutableBooleanArray
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_trusted_len<I, P>(&mut self, iterator: I)
pub fn extend_trusted_len<I, P>(&mut self, iterator: I)
Extends the MutableBooleanArray
from an iterator of trusted len.
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 the MutableBooleanArray
from an iterator of trusted len.
§Safety
The iterator must be trusted len.
source§impl MutableBooleanArray
impl MutableBooleanArray
Getters
sourcepub fn values(&self) -> &MutableBitmap
pub fn values(&self) -> &MutableBitmap
Returns its values.
source§impl MutableBooleanArray
impl MutableBooleanArray
Setters
source§impl MutableBooleanArray
impl MutableBooleanArray
From implementations
sourcepub fn from_trusted_len_values_iter<I: TrustedLen<Item = bool>>(
iterator: I
) -> Self
pub fn from_trusted_len_values_iter<I: TrustedLen<Item = bool>>( iterator: I ) -> Self
Creates a new MutableBooleanArray
from an TrustedLen
of bool
.
sourcepub unsafe fn from_trusted_len_values_iter_unchecked<I: Iterator<Item = bool>>(
iterator: I
) -> Self
pub unsafe fn from_trusted_len_values_iter_unchecked<I: Iterator<Item = bool>>( iterator: I ) -> Self
Creates a new MutableBooleanArray
from an TrustedLen
of bool
.
Use this over BooleanArray::from_trusted_len_iter
when the iterator is trusted len
but this crate does not mark it as such.
§Safety
The iterator must be TrustedLen
.
I.e. that size_hint().1
correctly reports its length.
sourcepub fn from_slice<P: AsRef<[bool]>>(slice: P) -> Self
pub fn from_slice<P: AsRef<[bool]>>(slice: P) -> Self
Creates a new MutableBooleanArray
from a slice of bool
.
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
Creates a BooleanArray
from an iterator of trusted length.
Use this over BooleanArray::from_trusted_len_iter
when the iterator is trusted len
but this crate does not mark it as such.
§Safety
The iterator must be TrustedLen
.
I.e. that size_hint().1
correctly reports its length.
sourcepub fn from_trusted_len_iter<I, P>(iterator: I) -> Self
pub fn from_trusted_len_iter<I, P>(iterator: I) -> Self
Creates a BooleanArray
from a TrustedLen
.
sourcepub unsafe fn try_from_trusted_len_iter_unchecked<E, I, P>(
iterator: I
) -> Result<Self, E>
pub unsafe fn try_from_trusted_len_iter_unchecked<E, I, P>( iterator: I ) -> Result<Self, E>
Creates a BooleanArray
from an falible 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<Self, E>
pub fn try_from_trusted_len_iter<E, I, P>(iterator: I) -> Result<Self, E>
Creates a BooleanArray
from a TrustedLen
.
sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Shrinks the capacity of the MutableBooleanArray
to fit its current length.
Trait Implementations§
source§impl Clone for MutableBooleanArray
impl Clone for MutableBooleanArray
source§fn clone(&self) -> MutableBooleanArray
fn clone(&self) -> MutableBooleanArray
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for MutableBooleanArray
impl Debug for MutableBooleanArray
source§impl Default for MutableBooleanArray
impl Default for MutableBooleanArray
source§impl Extend<Option<bool>> for MutableBooleanArray
impl Extend<Option<bool>> for MutableBooleanArray
source§fn extend<I: IntoIterator<Item = Option<bool>>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = Option<bool>>>(&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 From<MutableBooleanArray> for BooleanArray
impl From<MutableBooleanArray> for BooleanArray
source§fn from(other: MutableBooleanArray) -> Self
fn from(other: MutableBooleanArray) -> Self
source§impl<P: AsRef<[Option<bool>]>> From<P> for MutableBooleanArray
impl<P: AsRef<[Option<bool>]>> From<P> for MutableBooleanArray
source§fn from(slice: P) -> Self
fn from(slice: P) -> Self
Creates a new MutableBooleanArray
out of a slice of Optional bool
.
source§impl<Ptr: Borrow<Option<bool>>> FromIterator<Ptr> for MutableBooleanArray
impl<Ptr: Borrow<Option<bool>>> FromIterator<Ptr> for MutableBooleanArray
source§fn from_iter<I: IntoIterator<Item = Ptr>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = Ptr>>(iter: I) -> Self
source§impl<'a> IntoIterator for &'a MutableBooleanArray
impl<'a> IntoIterator for &'a MutableBooleanArray
§type IntoIter = ZipValidity<bool, BitmapIter<'a>, BitmapIter<'a>>
type IntoIter = ZipValidity<bool, BitmapIter<'a>, BitmapIter<'a>>
source§impl MutableArray for MutableBooleanArray
impl MutableArray for MutableBooleanArray
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 PartialEq for MutableBooleanArray
impl PartialEq for MutableBooleanArray
source§impl TryExtend<Option<bool>> for MutableBooleanArray
impl TryExtend<Option<bool>> for MutableBooleanArray
source§fn try_extend<I: IntoIterator<Item = Option<bool>>>(
&mut self,
iter: I
) -> Result<(), Error>
fn try_extend<I: IntoIterator<Item = Option<bool>>>( &mut self, iter: I ) -> Result<(), Error>
This is infalible and is implemented for consistency with all other types