pub struct MutableBinaryArray<O>where
O: Offset,{
values: MutableBinaryValuesArray<O>,
validity: Option<MutableBitmap>,
}
Expand description
The Arrow’s equivalent to Vec<Option<Vec<u8>>>
.
Converting a MutableBinaryArray
into a BinaryArray
is O(1)
.
§Implementation
This struct does not allocate a validity until one is required (i.e. push a null to it).
Fields§
§values: MutableBinaryValuesArray<O>
§validity: Option<MutableBitmap>
Implementations§
§impl<O> MutableBinaryArray<O>where
O: Offset,
impl<O> MutableBinaryArray<O>where
O: Offset,
pub fn new() -> MutableBinaryArray<O>
pub fn new() -> MutableBinaryArray<O>
pub fn try_new(
data_type: DataType,
offsets: Offsets<O>,
values: Vec<u8>,
validity: Option<MutableBitmap>
) -> Result<MutableBinaryArray<O>, Error>
pub fn try_new( data_type: DataType, offsets: Offsets<O>, values: Vec<u8>, validity: Option<MutableBitmap> ) -> Result<MutableBinaryArray<O>, Error>
Returns a MutableBinaryArray
created from its internal representation.
§Errors
This function returns an error iff:
- The last offset is not equal to the values’ length.
- the validity’s length is not equal to
offsets.len()
. - The
data_type
’scrate::datatypes::PhysicalType
is not equal to eitherBinary
orLargeBinary
.
§Implementation
This function is O(1)
pub fn from<T, P>(slice: P) -> MutableBinaryArray<O>
pub fn from<T, P>(slice: P) -> MutableBinaryArray<O>
Creates a new MutableBinaryArray
from a slice of optional &[u8]
.
pub fn with_capacity(capacity: usize) -> MutableBinaryArray<O>
pub fn with_capacity(capacity: usize) -> MutableBinaryArray<O>
Initializes a new MutableBinaryArray
with a pre-allocated capacity of slots.
pub fn with_capacities(capacity: usize, values: usize) -> MutableBinaryArray<O>
pub fn with_capacities(capacity: usize, values: usize) -> MutableBinaryArray<O>
Initializes a new MutableBinaryArray
with a pre-allocated capacity of slots and values.
§Implementation
This does not allocate the validity.
pub fn reserve(&mut self, additional: usize, additional_values: usize)
pub fn reserve(&mut self, additional: usize, additional_values: usize)
Reserves additional
elements and additional_values
on the values buffer.
pub fn push<T>(&mut self, value: Option<T>)
pub fn push<T>(&mut self, value: Option<T>)
Pushes a new element to the array.
§Panic
This operation panics iff the length of all values (in bytes) exceeds O
maximum value.
pub fn pop(&mut self) -> Option<Vec<u8>>
pub fn pop(&mut self) -> Option<Vec<u8>>
Pop the last entry from MutableBinaryArray
.
This function returns None
iff this array is empty
pub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Shrinks the capacity of the MutableBinaryArray
to fit its current length.
pub fn with_validity(
self,
validity: Option<MutableBitmap>
) -> MutableBinaryArray<O>
pub fn with_validity( self, validity: Option<MutableBitmap> ) -> MutableBinaryArray<O>
pub fn set_validity(&mut self, validity: Option<MutableBitmap>)
pub fn set_validity(&mut self, validity: Option<MutableBitmap>)
pub fn apply_validity<F>(&mut self, f: F)
pub fn apply_validity<F>(&mut self, f: F)
§impl<O> MutableBinaryArray<O>where
O: Offset,
impl<O> MutableBinaryArray<O>where
O: Offset,
pub fn iter(
&self
) -> ZipValidity<&[u8], ArrayValuesIter<'_, MutableBinaryValuesArray<O>>, BitmapIter<'_>> ⓘ
pub fn iter( &self ) -> ZipValidity<&[u8], ArrayValuesIter<'_, MutableBinaryValuesArray<O>>, BitmapIter<'_>> ⓘ
Returns an iterator of Option<&[u8]>
pub fn values_iter(&self) -> ArrayValuesIter<'_, MutableBinaryValuesArray<O>> ⓘ
pub fn values_iter(&self) -> ArrayValuesIter<'_, MutableBinaryValuesArray<O>> ⓘ
Returns an iterator over the values of this array
§impl<O> MutableBinaryArray<O>where
O: Offset,
impl<O> MutableBinaryArray<O>where
O: Offset,
pub unsafe fn from_trusted_len_iter_unchecked<I, P>(
iterator: I
) -> MutableBinaryArray<O>
pub unsafe fn from_trusted_len_iter_unchecked<I, P>( iterator: I ) -> MutableBinaryArray<O>
Creates a MutableBinaryArray
from an iterator of trusted length.
§Safety
The iterator must be TrustedLen
.
I.e. that size_hint().1
correctly reports its length.
pub fn from_trusted_len_iter<I, P>(iterator: I) -> MutableBinaryArray<O>
pub fn from_trusted_len_iter<I, P>(iterator: I) -> MutableBinaryArray<O>
Creates a MutableBinaryArray
from an iterator of trusted length.
pub unsafe fn from_trusted_len_values_iter_unchecked<T, I>(
iterator: I
) -> MutableBinaryArray<O>
pub unsafe fn from_trusted_len_values_iter_unchecked<T, I>( iterator: I ) -> MutableBinaryArray<O>
Creates a new BinaryArray
from a TrustedLen
of &[u8]
.
§Safety
The iterator must be TrustedLen
.
I.e. that size_hint().1
correctly reports its length.
pub fn from_trusted_len_values_iter<T, I>(iterator: I) -> MutableBinaryArray<O>
pub fn from_trusted_len_values_iter<T, I>(iterator: I) -> MutableBinaryArray<O>
Creates a new BinaryArray
from a TrustedLen
of &[u8]
.
pub unsafe fn try_from_trusted_len_iter_unchecked<E, I, P>(
iterator: I
) -> Result<MutableBinaryArray<O>, E>
pub unsafe fn try_from_trusted_len_iter_unchecked<E, I, P>( iterator: I ) -> Result<MutableBinaryArray<O>, E>
Creates a MutableBinaryArray
from an falible iterator of trusted length.
§Safety
The iterator must be TrustedLen
.
I.e. that size_hint().1
correctly reports its length.
pub fn try_from_trusted_len_iter<E, I, P>(
iterator: I
) -> Result<MutableBinaryArray<O>, E>
pub fn try_from_trusted_len_iter<E, I, P>( iterator: I ) -> Result<MutableBinaryArray<O>, E>
Creates a MutableBinaryArray
from an falible iterator of trusted length.
pub fn extend_trusted_len_values<I, P>(&mut self, iterator: I)
pub fn extend_trusted_len_values<I, P>(&mut self, iterator: I)
Extends the MutableBinaryArray
from an iterator of trusted length.
This differs from extend_trusted_len
which accepts iterator of optional values.
pub fn extend_values<I, P>(&mut self, iterator: I)
pub fn extend_values<I, P>(&mut self, iterator: I)
Extends the MutableBinaryArray
from an iterator of values.
This differs from extended_trusted_len
which accepts iterator of optional values.
pub unsafe fn extend_trusted_len_values_unchecked<I, P>(&mut self, iterator: I)
pub unsafe fn extend_trusted_len_values_unchecked<I, P>(&mut self, iterator: I)
Extends the MutableBinaryArray
from an iterator
of values of trusted length.
This differs from extend_trusted_len_unchecked
which accepts iterator of optional
values.
§Safety
The iterator
must be TrustedLen
pub fn extend_trusted_len<I, P>(&mut self, iterator: I)
pub fn extend_trusted_len<I, P>(&mut self, iterator: I)
Extends the MutableBinaryArray
from an iterator of TrustedLen
pub 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 MutableBinaryArray
from an iterator of TrustedLen
§Safety
The iterator
must be TrustedLen
pub fn from_iter_values<T, I>(iterator: I) -> MutableBinaryArray<O>
pub fn from_iter_values<T, I>(iterator: I) -> MutableBinaryArray<O>
Creates a new MutableBinaryArray
from a Iterator
of &[u8]
.
pub fn extend_fallible<T, I, E>(&mut self, iter: I) -> Result<(), E>
pub fn extend_fallible<T, I, E>(&mut self, iter: I) -> Result<(), E>
Extend with a fallible iterator
Trait Implementations§
§impl<O> Clone for MutableBinaryArray<O>
impl<O> Clone for MutableBinaryArray<O>
§fn clone(&self) -> MutableBinaryArray<O>
fn clone(&self) -> MutableBinaryArray<O>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl<O> Debug for MutableBinaryArray<O>
impl<O> Debug for MutableBinaryArray<O>
§impl<O> Default for MutableBinaryArray<O>where
O: Offset,
impl<O> Default for MutableBinaryArray<O>where
O: Offset,
§fn default() -> MutableBinaryArray<O>
fn default() -> MutableBinaryArray<O>
§impl<O, T> Extend<Option<T>> for MutableBinaryArray<O>
impl<O, T> Extend<Option<T>> for MutableBinaryArray<O>
§fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = Option<T>>,
fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = Option<T>>,
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
)§impl<O> From<MutableBinaryArray<O>> for BinaryArray<O>where
O: Offset,
impl<O> From<MutableBinaryArray<O>> for BinaryArray<O>where
O: Offset,
§fn from(other: MutableBinaryArray<O>) -> BinaryArray<O>
fn from(other: MutableBinaryArray<O>) -> BinaryArray<O>
§impl<O> From<MutableBinaryValuesArray<O>> for MutableBinaryArray<O>where
O: Offset,
impl<O> From<MutableBinaryValuesArray<O>> for MutableBinaryArray<O>where
O: Offset,
§fn from(other: MutableBinaryValuesArray<O>) -> MutableBinaryArray<O>
fn from(other: MutableBinaryValuesArray<O>) -> MutableBinaryArray<O>
§impl<O, P> FromIterator<Option<P>> for MutableBinaryArray<O>
impl<O, P> FromIterator<Option<P>> for MutableBinaryArray<O>
§fn from_iter<I>(iter: I) -> MutableBinaryArray<O>where
I: IntoIterator<Item = Option<P>>,
fn from_iter<I>(iter: I) -> MutableBinaryArray<O>where
I: IntoIterator<Item = Option<P>>,
§impl<O> MutableArray for MutableBinaryArray<O>where
O: Offset,
impl<O> MutableArray for MutableBinaryArray<O>where
O: Offset,
§fn validity(&self) -> Option<&MutableBitmap>
fn validity(&self) -> Option<&MutableBitmap>
§fn as_arc(&mut self) -> Arc<dyn Array>
fn as_arc(&mut self) -> Arc<dyn Array>
Array
.§fn as_mut_any(&mut self) -> &mut (dyn Any + 'static)
fn as_mut_any(&mut self) -> &mut (dyn Any + 'static)
Any
, to enable dynamic casting.§fn shrink_to_fit(&mut self)
fn shrink_to_fit(&mut self)
§impl<O> PartialEq for MutableBinaryArray<O>where
O: Offset,
impl<O> PartialEq for MutableBinaryArray<O>where
O: Offset,
§fn eq(&self, other: &MutableBinaryArray<O>) -> bool
fn eq(&self, other: &MutableBinaryArray<O>) -> bool
self
and other
values to be equal, and is used
by ==
.§impl<O, T> TryExtend<Option<T>> for MutableBinaryArray<O>
impl<O, T> TryExtend<Option<T>> for MutableBinaryArray<O>
§fn try_extend<I>(&mut self, iter: I) -> Result<(), Error>where
I: IntoIterator<Item = Option<T>>,
fn try_extend<I>(&mut self, iter: I) -> Result<(), Error>where
I: IntoIterator<Item = Option<T>>,
Extend::extend
.§impl<O> TryExtendFromSelf for MutableBinaryArray<O>where
O: Offset,
impl<O> TryExtendFromSelf for MutableBinaryArray<O>where
O: Offset,
§fn try_extend_from_self(
&mut self,
other: &MutableBinaryArray<O>
) -> Result<(), Error>
fn try_extend_from_self( &mut self, other: &MutableBinaryArray<O> ) -> Result<(), Error>
other
, failing only on overflow.Auto Trait Implementations§
impl<O> Freeze for MutableBinaryArray<O>
impl<O> RefUnwindSafe for MutableBinaryArray<O>
impl<O> Send for MutableBinaryArray<O>
impl<O> Sync for MutableBinaryArray<O>
impl<O> Unpin for MutableBinaryArray<O>where
O: Unpin,
impl<O> UnwindSafe for MutableBinaryArray<O>where
O: UnwindSafe,
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> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moresource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request