pub struct MutableUtf8ValuesArray<O: Offset> { /* private fields */ }
Expand description
A MutableArray
that builds a Utf8Array
. It differs
from MutableUtf8Array
in that it builds non-null Utf8Array
.
Implementations§
Source§impl<O: Offset> MutableUtf8ValuesArray<O>
impl<O: Offset> MutableUtf8ValuesArray<O>
Sourcepub fn new() -> Self
pub fn new() -> Self
Returns an empty MutableUtf8ValuesArray
.
Sourcepub fn try_new(
dtype: ArrowDataType,
offsets: Offsets<O>,
values: Vec<u8>,
) -> PolarsResult<Self>
pub fn try_new( dtype: ArrowDataType, offsets: Offsets<O>, values: Vec<u8>, ) -> PolarsResult<Self>
Returns a MutableUtf8ValuesArray
created from its internal representation.
§Errors
This function returns an error iff:
- The last offset is not equal to the values’ length.
- The
dtype
’scrate::datatypes::PhysicalType
is not equal to eitherUtf8
orLargeUtf8
. - The
values
between two consecutiveoffsets
are not valid utf8
§Implementation
This function is O(N)
- checking utf8 is O(N)
Sourcepub unsafe fn new_unchecked(
dtype: ArrowDataType,
offsets: Offsets<O>,
values: Vec<u8>,
) -> Self
pub unsafe fn new_unchecked( dtype: ArrowDataType, offsets: Offsets<O>, values: Vec<u8>, ) -> Self
Returns a MutableUtf8ValuesArray
created from its internal representation.
§Panic
This function does not panic iff:
- The last offset is equal to the values’ length.
- The
dtype
’scrate::datatypes::PhysicalType
is equal to eitherUtf8
orLargeUtf8
.
§Safety
This function is safe iff:
- the offsets are monotonically increasing
- The
values
between two consecutiveoffsets
are not valid utf8
§Implementation
This function is O(1)
Sourcepub fn default_dtype() -> ArrowDataType
pub fn default_dtype() -> ArrowDataType
Returns the default ArrowDataType
of this container: ArrowDataType::Utf8
or ArrowDataType::LargeUtf8
depending on the generic Offset
.
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Initializes a new MutableUtf8ValuesArray
with a pre-allocated capacity of items.
Sourcepub fn with_capacities(capacity: usize, values: usize) -> Self
pub fn with_capacities(capacity: usize, values: usize) -> Self
Initializes a new MutableUtf8ValuesArray
with a pre-allocated capacity of items 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.
Sourcepub fn push<T: AsRef<str>>(&mut self, value: T)
pub fn push<T: AsRef<str>>(&mut self, value: T)
Pushes a new item to the array.
§Panic
This operation panics iff the length of all values (in bytes) exceeds O
maximum value.
Sourcepub fn pop(&mut self) -> Option<String>
pub fn pop(&mut self) -> Option<String>
Pop the last entry from MutableUtf8ValuesArray
.
This function returns None
iff this array is empty.
Sourcepub unsafe fn value_unchecked(&self, i: usize) -> &str
pub unsafe fn value_unchecked(&self, i: usize) -> &str
Sourcepub fn iter(&self) -> ArrayValuesIter<'_, Self> ⓘ
pub fn iter(&self) -> ArrayValuesIter<'_, Self> ⓘ
Returns an iterator of &str
Sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Shrinks the capacity of the MutableUtf8ValuesArray
to fit its current length.
Sourcepub fn into_inner(self) -> (ArrowDataType, Offsets<O>, Vec<u8>)
pub fn into_inner(self) -> (ArrowDataType, Offsets<O>, Vec<u8>)
Extract the low-end APIs from the MutableUtf8ValuesArray
.
Source§impl<O: Offset> MutableUtf8ValuesArray<O>
impl<O: Offset> MutableUtf8ValuesArray<O>
Sourcepub fn extend_trusted_len<I, P>(&mut self, iterator: I)
pub fn extend_trusted_len<I, P>(&mut self, iterator: I)
Extends the MutableUtf8ValuesArray
from a TrustedLen
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 MutableUtf8ValuesArray
from an iterator of trusted len.
§Safety
The iterator must be trusted len.
Sourcepub fn from_trusted_len_iter<I, P>(iterator: I) -> Self
pub fn from_trusted_len_iter<I, P>(iterator: I) -> Self
Creates a MutableUtf8ValuesArray
from a TrustedLen
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
Returns a new MutableUtf8ValuesArray
from an iterator of trusted length.
§Safety
The iterator must be TrustedLen
.
I.e. that size_hint().1
correctly reports its length.
Sourcepub fn try_from_iter<P: AsRef<str>, I: IntoIterator<Item = P>>(
iter: I,
) -> PolarsResult<Self>
pub fn try_from_iter<P: AsRef<str>, I: IntoIterator<Item = P>>( iter: I, ) -> PolarsResult<Self>
Returns a new MutableUtf8ValuesArray
from an iterator.
§Error
This operation errors iff the total length in bytes on the iterator exceeds O
’s maximum value.
(i32::MAX
or i64::MAX
respectively).
Sourcepub 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§
Source§impl<'a, O: Offset> ArrayAccessor<'a> for MutableUtf8ValuesArray<O>
impl<'a, O: Offset> ArrayAccessor<'a> for MutableUtf8ValuesArray<O>
Source§impl<O: Clone + Offset> Clone for MutableUtf8ValuesArray<O>
impl<O: Clone + Offset> Clone for MutableUtf8ValuesArray<O>
Source§fn clone(&self) -> MutableUtf8ValuesArray<O>
fn clone(&self) -> MutableUtf8ValuesArray<O>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<O: Offset> Default for MutableUtf8ValuesArray<O>
impl<O: Offset> Default for MutableUtf8ValuesArray<O>
Source§impl<O: Offset, T: AsRef<str>> Extend<T> for MutableUtf8ValuesArray<O>
impl<O: Offset, T: AsRef<str>> Extend<T> for MutableUtf8ValuesArray<O>
Source§fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = T>>(&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<O: Offset> From<MutableUtf8ValuesArray<O>> for MutableUtf8Array<O>
impl<O: Offset> From<MutableUtf8ValuesArray<O>> for MutableUtf8Array<O>
Source§fn from(other: MutableUtf8ValuesArray<O>) -> Self
fn from(other: MutableUtf8ValuesArray<O>) -> Self
Source§impl<O: Offset> From<MutableUtf8ValuesArray<O>> for Utf8Array<O>
impl<O: Offset> From<MutableUtf8ValuesArray<O>> for Utf8Array<O>
Source§fn from(other: MutableUtf8ValuesArray<O>) -> Self
fn from(other: MutableUtf8ValuesArray<O>) -> Self
Source§impl<O: Offset, P: AsRef<str>> FromIterator<P> for MutableUtf8ValuesArray<O>
impl<O: Offset, P: AsRef<str>> FromIterator<P> for MutableUtf8ValuesArray<O>
Source§fn from_iter<I: IntoIterator<Item = P>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = P>>(iter: I) -> Self
Source§impl<'a, O: Offset> IntoIterator for &'a MutableUtf8ValuesArray<O>
impl<'a, O: Offset> IntoIterator for &'a MutableUtf8ValuesArray<O>
Source§impl<O: Offset> MutableArray for MutableUtf8ValuesArray<O>
impl<O: Offset> MutableArray for MutableUtf8ValuesArray<O>
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<O: Offset, T: AsRef<str>> TryExtend<T> for MutableUtf8ValuesArray<O>
impl<O: Offset, T: AsRef<str>> TryExtend<T> for MutableUtf8ValuesArray<O>
Source§fn try_extend<I: IntoIterator<Item = T>>(&mut self, iter: I) -> PolarsResult<()>
fn try_extend<I: IntoIterator<Item = T>>(&mut self, iter: I) -> PolarsResult<()>
Extend::extend
.Source§impl<O: Offset> TryExtendFromSelf for MutableUtf8ValuesArray<O>
impl<O: Offset> TryExtendFromSelf for MutableUtf8ValuesArray<O>
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<O> Freeze for MutableUtf8ValuesArray<O>
impl<O> RefUnwindSafe for MutableUtf8ValuesArray<O>
impl<O> Send for MutableUtf8ValuesArray<O>
impl<O> Sync for MutableUtf8ValuesArray<O>
impl<O> Unpin for MutableUtf8ValuesArray<O>where
O: Unpin,
impl<O> UnwindSafe for MutableUtf8ValuesArray<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> 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