pub struct MutableUtf8Array<O>where
O: Offset,{ /* private fields */ }Expand description
A MutableArray that builds a Utf8Array. It differs
from MutableUtf8ValuesArray in that it can build nullable Utf8Arrays.
Implementations§
Source§impl<O> MutableUtf8Array<O>where
O: Offset,
impl<O> MutableUtf8Array<O>where
O: Offset,
Sourcepub fn new() -> MutableUtf8Array<O>
pub fn new() -> MutableUtf8Array<O>
Initializes a new empty MutableUtf8Array.
Sourcepub fn try_new(
data_type: DataType,
offsets: Vec<O>,
values: Vec<u8>,
validity: Option<MutableBitmap>,
) -> Result<MutableUtf8Array<O>, Error>
pub fn try_new( data_type: DataType, offsets: Vec<O>, values: Vec<u8>, validity: Option<MutableBitmap>, ) -> Result<MutableUtf8Array<O>, Error>
Returns a MutableUtf8Array created from its internal representation.
§Errors
This function returns an error iff:
- the offsets are not monotonically increasing
- The last offset is not equal to the values’ length.
- the validity’s length is not equal to
offsets.len() - 1. - The
data_type’scrate::datatypes::PhysicalTypeis not equal to eitherUtf8orLargeUtf8. - The
valuesbetween two consecutiveoffsetsare not valid utf8
§Implementation
This function is O(N) - checking monotinicity and utf8 is O(N)
Sourcepub unsafe fn new_unchecked(
data_type: DataType,
offsets: Vec<O>,
values: Vec<u8>,
validity: Option<MutableBitmap>,
) -> MutableUtf8Array<O>
pub unsafe fn new_unchecked( data_type: DataType, offsets: Vec<O>, values: Vec<u8>, validity: Option<MutableBitmap>, ) -> MutableUtf8Array<O>
Create a MutableUtf8Array out of low-end APIs.
§Safety
The caller must ensure that every value between offsets is a valid utf8.
§Panics
This function panics iff:
- The
offsetsandvaluesare inconsistent - The validity is not
Noneand its length is different fromoffsets’s length minus one.
Sourcepub unsafe fn from_data_unchecked(
data_type: DataType,
offsets: Vec<O>,
values: Vec<u8>,
validity: Option<MutableBitmap>,
) -> MutableUtf8Array<O>
pub unsafe fn from_data_unchecked( data_type: DataType, offsets: Vec<O>, values: Vec<u8>, validity: Option<MutableBitmap>, ) -> MutableUtf8Array<O>
Alias of new_unchecked
§Safety
The caller must ensure that every value between offsets is a valid utf8.
Sourcepub fn from_data(
data_type: DataType,
offsets: Vec<O>,
values: Vec<u8>,
validity: Option<MutableBitmap>,
) -> MutableUtf8Array<O>
pub fn from_data( data_type: DataType, offsets: Vec<O>, values: Vec<u8>, validity: Option<MutableBitmap>, ) -> MutableUtf8Array<O>
The canonical method to create a MutableUtf8Array out of low-end APIs.
§Panics
This function panics iff:
- The
offsetsandvaluesare inconsistent - The
valuesbetweenoffsetsare not utf8 encoded - The validity is not
Noneand its length is different fromoffsets’s length minus one.
Sourcepub fn with_capacity(capacity: usize) -> MutableUtf8Array<O>
pub fn with_capacity(capacity: usize) -> MutableUtf8Array<O>
Initializes a new MutableUtf8Array with a pre-allocated capacity of slots.
Sourcepub fn with_capacities(capacity: usize, values: usize) -> MutableUtf8Array<O>
pub fn with_capacities(capacity: usize, values: usize) -> MutableUtf8Array<O>
Initializes a new MutableUtf8Array with a pre-allocated capacity of slots and values.
Sourcepub 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.
Sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Reserves additional elements and additional_values on the values buffer.
Sourcepub 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.
Sourcepub fn value(&self, i: usize) -> &str
pub fn value(&self, i: usize) -> &str
Returns the value of the element at index i, ignoring the array’s validity.
§Safety
This function is safe iff i < self.len.
Sourcepub unsafe fn value_unchecked(&self, i: usize) -> &str
pub unsafe fn value_unchecked(&self, i: usize) -> &str
Returns the value of the element at index i, ignoring the array’s validity.
§Safety
This function is safe iff i < self.len.
Sourcepub fn pop(&mut self) -> Option<String>
pub fn pop(&mut self) -> Option<String>
Pop the last entry from MutableUtf8Array.
This function returns None iff this array is empty.
Sourcepub fn iter(
&self,
) -> ZipValidity<'_, &str, ArrayValuesIter<'_, MutableUtf8ValuesArray<O>>> ⓘ
pub fn iter( &self, ) -> ZipValidity<'_, &str, ArrayValuesIter<'_, MutableUtf8ValuesArray<O>>> ⓘ
Returns an iterator of Option<&str>
Sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Shrinks the capacity of the MutableUtf8Array to fit its current length.
Sourcepub fn into_data(self) -> (DataType, Vec<O>, Vec<u8>, Option<MutableBitmap>)
pub fn into_data(self) -> (DataType, Vec<O>, Vec<u8>, Option<MutableBitmap>)
Extract the low-end APIs from the MutableUtf8Array.
Sourcepub fn values_iter(&self) -> ArrayValuesIter<'_, MutableUtf8ValuesArray<O>> ⓘ
pub fn values_iter(&self) -> ArrayValuesIter<'_, MutableUtf8ValuesArray<O>> ⓘ
Returns an iterator of &str
Source§impl<O> MutableUtf8Array<O>where
O: Offset,
impl<O> MutableUtf8Array<O>where
O: Offset,
Source§impl<O> MutableUtf8Array<O>where
O: Offset,
impl<O> MutableUtf8Array<O>where
O: Offset,
Sourcepub 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 MutableUtf8Array from an iterator of values of trusted len.
This differs from extended_trusted_len which accepts iterator of optional values.
Sourcepub fn extend_values<I, P>(&mut self, iterator: I)
pub fn extend_values<I, P>(&mut self, iterator: I)
Extends the MutableUtf8Array from an iterator of values.
This differs from extended_trusted_len which accepts iterator of optional values.
Sourcepub 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 MutableUtf8Array from an iterator of values of trusted len.
This differs from extended_trusted_len_unchecked which accepts 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 MutableUtf8Array 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)
Sourcepub unsafe fn from_trusted_len_iter_unchecked<I, P>(
iterator: I,
) -> MutableUtf8Array<O>
pub unsafe fn from_trusted_len_iter_unchecked<I, P>( iterator: I, ) -> MutableUtf8Array<O>
Creates a MutableUtf8Array from an iterator of trusted length.
§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) -> MutableUtf8Array<O>
pub fn from_trusted_len_iter<I, P>(iterator: I) -> MutableUtf8Array<O>
Creates a MutableUtf8Array from an iterator of trusted length.
Sourcepub unsafe fn from_trusted_len_values_iter_unchecked<T, I>(
iterator: I,
) -> MutableUtf8Array<O>
pub unsafe fn from_trusted_len_values_iter_unchecked<T, I>( iterator: I, ) -> MutableUtf8Array<O>
Creates a MutableUtf8Array from an iterator of trusted length of &str.
§Safety
The iterator must be TrustedLen.
I.e. that size_hint().1 correctly reports its length.
Sourcepub fn from_trusted_len_values_iter<T, I>(iterator: I) -> MutableUtf8Array<O>
pub fn from_trusted_len_values_iter<T, I>(iterator: I) -> MutableUtf8Array<O>
Creates a new MutableUtf8Array from a TrustedLen of &str.
Sourcepub unsafe fn try_from_trusted_len_iter_unchecked<E, I, P>(
iterator: I,
) -> Result<MutableUtf8Array<O>, E>
pub unsafe fn try_from_trusted_len_iter_unchecked<E, I, P>( iterator: I, ) -> Result<MutableUtf8Array<O>, E>
Creates a MutableUtf8Array 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<MutableUtf8Array<O>, E>
pub fn try_from_trusted_len_iter<E, I, P>( iterator: I, ) -> Result<MutableUtf8Array<O>, E>
Creates a MutableUtf8Array from an falible iterator of trusted length.
Sourcepub fn from_iter_values<T, I>(iterator: I) -> MutableUtf8Array<O>
pub fn from_iter_values<T, I>(iterator: I) -> MutableUtf8Array<O>
Creates a new MutableUtf8Array from a Iterator of &str.
Trait Implementations§
Source§impl<O> Debug for MutableUtf8Array<O>
impl<O> Debug for MutableUtf8Array<O>
Source§impl<O> Default for MutableUtf8Array<O>where
O: Offset,
impl<O> Default for MutableUtf8Array<O>where
O: Offset,
Source§fn default() -> MutableUtf8Array<O>
fn default() -> MutableUtf8Array<O>
Source§impl<O, T> Extend<Option<T>> for MutableUtf8Array<O>
impl<O, T> Extend<Option<T>> for MutableUtf8Array<O>
Source§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: T)
fn extend_one(&mut self, item: T)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Source§impl<O> From<MutableUtf8Array<O>> for Utf8Array<O>where
O: Offset,
impl<O> From<MutableUtf8Array<O>> for Utf8Array<O>where
O: Offset,
Source§fn from(other: MutableUtf8Array<O>) -> Utf8Array<O>
fn from(other: MutableUtf8Array<O>) -> Utf8Array<O>
Source§impl<O> From<MutableUtf8ValuesArray<O>> for MutableUtf8Array<O>where
O: Offset,
impl<O> From<MutableUtf8ValuesArray<O>> for MutableUtf8Array<O>where
O: Offset,
Source§fn from(other: MutableUtf8ValuesArray<O>) -> MutableUtf8Array<O>
fn from(other: MutableUtf8ValuesArray<O>) -> MutableUtf8Array<O>
Source§impl<O, P> FromIterator<Option<P>> for MutableUtf8Array<O>
impl<O, P> FromIterator<Option<P>> for MutableUtf8Array<O>
Source§fn from_iter<I>(iter: I) -> MutableUtf8Array<O>where
I: IntoIterator<Item = Option<P>>,
fn from_iter<I>(iter: I) -> MutableUtf8Array<O>where
I: IntoIterator<Item = Option<P>>,
Source§impl<'a, O> IntoIterator for &'a MutableUtf8Array<O>where
O: Offset,
impl<'a, O> IntoIterator for &'a MutableUtf8Array<O>where
O: Offset,
Source§type IntoIter = ZipValidity<'a, &'a str, ArrayValuesIter<'a, MutableUtf8ValuesArray<O>>>
type IntoIter = ZipValidity<'a, &'a str, ArrayValuesIter<'a, MutableUtf8ValuesArray<O>>>
Source§fn into_iter(self) -> <&'a MutableUtf8Array<O> as IntoIterator>::IntoIter
fn into_iter(self) -> <&'a MutableUtf8Array<O> as IntoIterator>::IntoIter
Source§impl<O> MutableArray for MutableUtf8Array<O>where
O: Offset,
impl<O> MutableArray for MutableUtf8Array<O>where
O: Offset,
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 + 'static)
fn as_mut_any(&mut self) -> &mut (dyn Any + 'static)
Any, to enable dynamic casting.Source§fn shrink_to_fit(&mut self)
fn shrink_to_fit(&mut self)
Source§impl<O, T> TryExtend<Option<T>> for MutableUtf8Array<O>
impl<O, T> TryExtend<Option<T>> for MutableUtf8Array<O>
Source§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.Auto Trait Implementations§
impl<O> Freeze for MutableUtf8Array<O>where
MutableUtf8ValuesArray<O>: Freeze,
impl<O> RefUnwindSafe for MutableUtf8Array<O>where
MutableUtf8ValuesArray<O>: RefUnwindSafe,
impl<O> Send for MutableUtf8Array<O>where
MutableUtf8ValuesArray<O>: Send,
impl<O> Sync for MutableUtf8Array<O>where
MutableUtf8ValuesArray<O>: Sync,
impl<O> Unpin for MutableUtf8Array<O>where
MutableUtf8ValuesArray<O>: Unpin,
impl<O> UnsafeUnpin for MutableUtf8Array<O>where
MutableUtf8ValuesArray<O>: UnsafeUnpin,
impl<O> UnwindSafe for MutableUtf8Array<O>where
MutableUtf8ValuesArray<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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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