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
sourceimpl<'a> MutableBooleanArray
impl<'a> MutableBooleanArray
sourcepub fn iter(&'a self) -> ZipValidity<'a, bool, BitmapIter<'a>>ⓘNotable traits for ZipValidity<'a, T, I>impl<'a, T, I: Iterator<Item = T>> Iterator for ZipValidity<'a, T, I> type Item = Option<T>;
pub fn iter(&'a self) -> ZipValidity<'a, bool, BitmapIter<'a>>ⓘNotable traits for ZipValidity<'a, T, I>impl<'a, T, I: Iterator<Item = T>> Iterator for ZipValidity<'a, T, I> type Item = Option<T>;
Returns an iterator over the optional values of this MutableBooleanArray
.
sourcepub fn values_iter(&'a self) -> BitmapIter<'a>ⓘNotable traits for BitmapIter<'a>impl<'a> Iterator for BitmapIter<'a> type Item = bool;
pub fn values_iter(&'a self) -> BitmapIter<'a>ⓘNotable traits for BitmapIter<'a>impl<'a> Iterator for BitmapIter<'a> type Item = bool;
Returns an iterator over the values of this MutableBooleanArray
sourceimpl MutableBooleanArray
impl MutableBooleanArray
sourcepub fn new() -> Self
pub fn new() -> Self
Creates an new empty MutableBooleanArray
.
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 from_data(
data_type: DataType,
values: MutableBitmap,
validity: Option<MutableBitmap>
) -> Self
pub fn from_data(
data_type: DataType,
values: MutableBitmap,
validity: Option<MutableBitmap>
) -> Self
Canonical method to create a new MutableBooleanArray
.
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) where
I: Iterator<Item = bool>,
pub unsafe fn extend_trusted_len_values_unchecked<I>(&mut self, iterator: I) where
I: Iterator<Item = bool>,
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) where
P: Borrow<bool>,
I: TrustedLen<Item = Option<P>>,
pub fn extend_trusted_len<I, P>(&mut self, iterator: I) where
P: Borrow<bool>,
I: TrustedLen<Item = Option<P>>,
Extends the MutableBooleanArray
from an iterator of trusted len.
sourcepub unsafe fn extend_trusted_len_unchecked<I, P>(&mut self, iterator: I) where
P: Borrow<bool>,
I: Iterator<Item = Option<P>>,
pub unsafe fn extend_trusted_len_unchecked<I, P>(&mut self, iterator: I) where
P: Borrow<bool>,
I: Iterator<Item = Option<P>>,
Extends the MutableBooleanArray
from an iterator of trusted len.
Safety
The iterator must be trusted len.
sourceimpl MutableBooleanArray
impl MutableBooleanArray
Getters
sourcepub fn values(&self) -> &MutableBitmap
pub fn values(&self) -> &MutableBitmap
Returns its values.
sourceimpl MutableBooleanArray
impl MutableBooleanArray
Setters
sourceimpl 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 where
P: Borrow<bool>,
I: Iterator<Item = Option<P>>,
pub unsafe fn from_trusted_len_iter_unchecked<I, P>(iterator: I) -> Self where
P: Borrow<bool>,
I: Iterator<Item = Option<P>>,
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 where
P: Borrow<bool>,
I: TrustedLen<Item = Option<P>>,
pub fn from_trusted_len_iter<I, P>(iterator: I) -> Self where
P: Borrow<bool>,
I: TrustedLen<Item = Option<P>>,
Creates a BooleanArray
from a TrustedLen
.
sourcepub unsafe fn try_from_trusted_len_iter_unchecked<E, I, P>(
iterator: I
) -> Result<Self, E> where
P: Borrow<bool>,
I: Iterator<Item = Result<Option<P>, E>>,
pub unsafe fn try_from_trusted_len_iter_unchecked<E, I, P>(
iterator: I
) -> Result<Self, E> where
P: Borrow<bool>,
I: Iterator<Item = Result<Option<P>, 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> where
P: Borrow<bool>,
I: TrustedLen<Item = Result<Option<P>, E>>,
pub fn try_from_trusted_len_iter<E, I, P>(iterator: I) -> Result<Self, E> where
P: Borrow<bool>,
I: TrustedLen<Item = Result<Option<P>, 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
sourceimpl Debug for MutableBooleanArray
impl Debug for MutableBooleanArray
sourceimpl Default for MutableBooleanArray
impl Default for MutableBooleanArray
sourceimpl Extend<Option<bool>> for MutableBooleanArray
impl Extend<Option<bool>> for MutableBooleanArray
sourcefn extend<I: IntoIterator<Item = Option<bool>>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = Option<bool>>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
sourcefn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Extends a collection with exactly one element.
sourcefn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
sourceimpl From<MutableBooleanArray> for BooleanArray
impl From<MutableBooleanArray> for BooleanArray
sourcefn from(other: MutableBooleanArray) -> Self
fn from(other: MutableBooleanArray) -> Self
Converts to this type from the input type.
sourceimpl<P: AsRef<[Option<bool>]>> From<P> for MutableBooleanArray
impl<P: AsRef<[Option<bool>]>> From<P> for MutableBooleanArray
sourcefn from(slice: P) -> Self
fn from(slice: P) -> Self
Creates a new MutableBooleanArray
out of a slice of Optional bool
.
sourceimpl<Ptr: Borrow<Option<bool>>> FromIterator<Ptr> for MutableBooleanArray
impl<Ptr: Borrow<Option<bool>>> FromIterator<Ptr> for MutableBooleanArray
sourcefn from_iter<I: IntoIterator<Item = Ptr>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = Ptr>>(iter: I) -> Self
Creates a value from an iterator. Read more
sourceimpl<'a> IntoIterator for &'a MutableBooleanArray
impl<'a> IntoIterator for &'a MutableBooleanArray
sourceimpl MutableArray for MutableBooleanArray
impl MutableArray for MutableBooleanArray
sourcefn validity(&self) -> Option<&MutableBitmap>
fn validity(&self) -> Option<&MutableBitmap>
The optional validity of the array.
sourcefn as_arc(&mut self) -> Arc<dyn Array>
fn as_arc(&mut self) -> Arc<dyn Array>
Convert itself to an (immutable) atomically reference counted Array
.
sourcefn as_mut_any(&mut self) -> &mut dyn Any
fn as_mut_any(&mut self) -> &mut dyn Any
Convert to mutable Any
, to enable dynamic casting.
sourcefn shrink_to_fit(&mut self)
fn shrink_to_fit(&mut self)
Shrink the array to fit its length.
sourceimpl PartialEq<MutableBooleanArray> for MutableBooleanArray
impl PartialEq<MutableBooleanArray> for MutableBooleanArray
sourceimpl TryExtend<Option<bool>> for MutableBooleanArray
impl TryExtend<Option<bool>> for MutableBooleanArray
sourcefn try_extend<I: IntoIterator<Item = Option<bool>>>(
&mut self,
iter: I
) -> Result<()>
fn try_extend<I: IntoIterator<Item = Option<bool>>>(
&mut self,
iter: I
) -> Result<()>
This is infalible and is implemented for consistency with all other types
Auto Trait Implementations
impl RefUnwindSafe for MutableBooleanArray
impl Send for MutableBooleanArray
impl Sync for MutableBooleanArray
impl Unpin for MutableBooleanArray
impl UnwindSafe for MutableBooleanArray
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more