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(
dtype: ArrowDataType,
values: MutableBitmap,
validity: Option<MutableBitmap>,
) -> PolarsResult<Self>
pub fn try_new( dtype: ArrowDataType, values: MutableBitmap, validity: Option<MutableBitmap>, ) -> PolarsResult<Self>
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
dtype
’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.
pub fn push_value(&mut self, value: bool)
pub fn push_null(&mut self)
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.
Sourcepub fn extend_constant(&mut self, additional: usize, value: Option<bool>)
pub fn extend_constant(&mut self, additional: usize, value: Option<bool>)
Extends MutableBooleanArray
by additional values of constant value.
pub fn freeze(self) -> BooleanArray
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
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 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 PartialEq for MutableBooleanArray
impl PartialEq for MutableBooleanArray
Source§impl Pushable<Option<bool>> for MutableBooleanArray
impl Pushable<Option<bool>> for MutableBooleanArray
type Freeze = BooleanArray
fn reserve(&mut self, additional: usize)
fn push(&mut self, value: Option<bool>)
fn len(&self) -> usize
fn push_null(&mut self)
fn extend_constant(&mut self, additional: usize, value: Option<bool>)
fn extend_null_constant(&mut self, additional: usize)
fn freeze(self) -> Self::Freeze
fn with_capacity(capacity: usize) -> Self
fn extend_n(&mut self, n: usize, iter: impl Iterator<Item = T>)
Source§impl Pushable<bool> for MutableBooleanArray
impl Pushable<bool> for MutableBooleanArray
type Freeze = BooleanArray
fn reserve(&mut self, additional: usize)
fn push(&mut self, value: bool)
fn len(&self) -> usize
fn push_null(&mut self)
fn extend_constant(&mut self, additional: usize, value: bool)
fn extend_null_constant(&mut self, _additional: usize)
fn freeze(self) -> Self::Freeze
fn with_capacity(capacity: usize) -> Self
fn extend_n(&mut self, n: usize, iter: impl Iterator<Item = T>)
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,
) -> PolarsResult<()>
fn try_extend<I: IntoIterator<Item = Option<bool>>>( &mut self, iter: I, ) -> PolarsResult<()>
This is infalible and is implemented for consistency with all other types
Source§impl TryExtendFromSelf for MutableBooleanArray
impl TryExtendFromSelf for MutableBooleanArray
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 MutableBooleanArray
impl RefUnwindSafe for MutableBooleanArray
impl Send for MutableBooleanArray
impl Sync for MutableBooleanArray
impl Unpin for MutableBooleanArray
impl UnwindSafe for MutableBooleanArray
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