pub struct BinaryArray<O> where
O: Offset, { /* private fields */ }
Expand description
A BinaryArray
is a nullable array of bytes - the Arrow equivalent of Vec<Option<Vec<u8>>>
.
Safety
The following invariants hold:
- Two consecutives
offsets
casted (as
) tousize
are valid slices ofvalues
. len
is equal tovalidity.len()
, when defined.
Implementations
sourceimpl<'a, O> BinaryArray<O> where
O: Offset,
impl<'a, O> BinaryArray<O> where
O: Offset,
sourcepub fn iter(&'a self) -> ZipValidity<'a, &'a [u8], BinaryValueIter<'a, O>>ⓘNotable traits for ZipValidity<'a, T, I>impl<'a, T, I> Iterator for ZipValidity<'a, T, I> where
I: Iterator<Item = T>, type Item = Option<T>;
pub fn iter(&'a self) -> ZipValidity<'a, &'a [u8], BinaryValueIter<'a, O>>ⓘNotable traits for ZipValidity<'a, T, I>impl<'a, T, I> Iterator for ZipValidity<'a, T, I> where
I: Iterator<Item = T>, type Item = Option<T>;
I: Iterator<Item = T>, type Item = Option<T>;
Returns an iterator of Option<&[u8]>
sourcepub fn values_iter(&'a self) -> BinaryValueIter<'a, O>ⓘNotable traits for BinaryValueIter<'a, O>impl<'a, O> Iterator for BinaryValueIter<'a, O> where
O: Offset, type Item = &'a [u8];
pub fn values_iter(&'a self) -> BinaryValueIter<'a, O>ⓘNotable traits for BinaryValueIter<'a, O>impl<'a, O> Iterator for BinaryValueIter<'a, O> where
O: Offset, type Item = &'a [u8];
O: Offset, type Item = &'a [u8];
Returns an iterator of &[u8]
sourceimpl<O> BinaryArray<O> where
O: Offset,
impl<O> BinaryArray<O> where
O: Offset,
sourcepub fn from_slice<T, P>(slice: P) -> BinaryArray<O> where
T: AsRef<[u8]>,
P: AsRef<[T]>,
pub fn from_slice<T, P>(slice: P) -> BinaryArray<O> where
T: AsRef<[u8]>,
P: AsRef<[T]>,
Creates a new BinaryArray
from slices of &[u8]
.
sourcepub fn from<T, P>(slice: P) -> BinaryArray<O> where
T: AsRef<[u8]>,
P: AsRef<[Option<T>]>,
pub fn from<T, P>(slice: P) -> BinaryArray<O> where
T: AsRef<[u8]>,
P: AsRef<[Option<T>]>,
Creates a new BinaryArray
from a slice of optional &[u8]
.
sourcepub fn from_trusted_len_values_iter<T, I>(iterator: I) -> BinaryArray<O> where
T: AsRef<[u8]>,
I: TrustedLen<Item = T>,
pub fn from_trusted_len_values_iter<T, I>(iterator: I) -> BinaryArray<O> where
T: AsRef<[u8]>,
I: TrustedLen<Item = T>,
Creates a BinaryArray
from an iterator of trusted length.
sourcepub fn from_iter_values<T, I>(iterator: I) -> BinaryArray<O> where
T: AsRef<[u8]>,
I: Iterator<Item = T>,
pub fn from_iter_values<T, I>(iterator: I) -> BinaryArray<O> where
T: AsRef<[u8]>,
I: Iterator<Item = T>,
Creates a new BinaryArray
from a Iterator
of &str
.
sourceimpl<O> BinaryArray<O> where
O: Offset,
impl<O> BinaryArray<O> where
O: Offset,
sourcepub unsafe fn from_trusted_len_iter_unchecked<I, P>(
iterator: I
) -> BinaryArray<O> where
P: AsRef<[u8]>,
I: Iterator<Item = Option<P>>,
pub unsafe fn from_trusted_len_iter_unchecked<I, P>(
iterator: I
) -> BinaryArray<O> where
P: AsRef<[u8]>,
I: Iterator<Item = Option<P>>,
Creates a BinaryArray
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) -> BinaryArray<O> where
P: AsRef<[u8]>,
I: TrustedLen<Item = Option<P>>,
pub fn from_trusted_len_iter<I, P>(iterator: I) -> BinaryArray<O> where
P: AsRef<[u8]>,
I: TrustedLen<Item = Option<P>>,
Creates a BinaryArray
from an iterator of trusted length.
sourcepub unsafe fn try_from_trusted_len_iter_unchecked<E, I, P>(
iterator: I
) -> Result<BinaryArray<O>, E> where
P: AsRef<[u8]>,
I: IntoIterator<Item = Result<Option<P>, E>>,
pub unsafe fn try_from_trusted_len_iter_unchecked<E, I, P>(
iterator: I
) -> Result<BinaryArray<O>, E> where
P: AsRef<[u8]>,
I: IntoIterator<Item = Result<Option<P>, E>>,
Creates a BinaryArray
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>(iter: I) -> Result<BinaryArray<O>, E> where
P: AsRef<[u8]>,
I: TrustedLen<Item = Result<Option<P>, E>>,
pub fn try_from_trusted_len_iter<E, I, P>(iter: I) -> Result<BinaryArray<O>, E> where
P: AsRef<[u8]>,
I: TrustedLen<Item = Result<Option<P>, E>>,
Creates a BinaryArray
from an fallible iterator of trusted length.
sourceimpl<O> BinaryArray<O> where
O: Offset,
impl<O> BinaryArray<O> where
O: Offset,
sourcepub fn try_new(
data_type: DataType,
offsets: Buffer<O>,
values: Buffer<u8>,
validity: Option<Bitmap>
) -> Result<BinaryArray<O>, ArrowError>
pub fn try_new(
data_type: DataType,
offsets: Buffer<O>,
values: Buffer<u8>,
validity: Option<Bitmap>
) -> Result<BinaryArray<O>, ArrowError>
Creates a new BinaryArray
.
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::PhysicalType
is not equal to eitherBinary
orLargeBinary
.
Implementation
This function is O(N)
- checking monotinicity is O(N)
sourcepub fn new(
data_type: DataType,
offsets: Buffer<O>,
values: Buffer<u8>,
validity: Option<Bitmap>
) -> BinaryArray<O>
pub fn new(
data_type: DataType,
offsets: Buffer<O>,
values: Buffer<u8>,
validity: Option<Bitmap>
) -> BinaryArray<O>
Creates a new BinaryArray
.
Panics
- 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::PhysicalType
is not equal to eitherBinary
orLargeBinary
.
Implementation
This function is O(N)
- checking monotinicity is O(N)
sourcepub fn from_data(
data_type: DataType,
offsets: Buffer<O>,
values: Buffer<u8>,
validity: Option<Bitmap>
) -> BinaryArray<O>
pub fn from_data(
data_type: DataType,
offsets: Buffer<O>,
values: Buffer<u8>,
validity: Option<Bitmap>
) -> BinaryArray<O>
Alias for new
sourcepub fn new_empty(data_type: DataType) -> BinaryArray<O>
pub fn new_empty(data_type: DataType) -> BinaryArray<O>
Creates an empty BinaryArray
, i.e. whose .len
is zero.
sourcepub fn new_null(data_type: DataType, length: usize) -> BinaryArray<O>
pub fn new_null(data_type: DataType, length: usize) -> BinaryArray<O>
Creates an null BinaryArray
, i.e. whose .null_count() == .len()
.
sourcepub fn default_data_type() -> DataType
pub fn default_data_type() -> DataType
Returns the default DataType
, DataType::Binary
or DataType::LargeBinary
sourceimpl<O> BinaryArray<O> where
O: Offset,
impl<O> BinaryArray<O> where
O: Offset,
sourcepub unsafe fn try_new_unchecked(
data_type: DataType,
offsets: Buffer<O>,
values: Buffer<u8>,
validity: Option<Bitmap>
) -> Result<BinaryArray<O>, ArrowError>
pub unsafe fn try_new_unchecked(
data_type: DataType,
offsets: Buffer<O>,
values: Buffer<u8>,
validity: Option<Bitmap>
) -> Result<BinaryArray<O>, ArrowError>
Creates a new BinaryArray
without checking for offsets monotinicity.
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() - 1
. - The
data_type
’scrate::datatypes::PhysicalType
is not equal to eitherBinary
orLargeBinary
.
Safety
This function is unsafe iff:
- the offsets are not monotonically increasing
Implementation
This function is O(1)
sourcepub unsafe fn new_unchecked(
data_type: DataType,
offsets: Buffer<O>,
values: Buffer<u8>,
validity: Option<Bitmap>
) -> BinaryArray<O>
pub unsafe fn new_unchecked(
data_type: DataType,
offsets: Buffer<O>,
values: Buffer<u8>,
validity: Option<Bitmap>
) -> BinaryArray<O>
Creates a new BinaryArray
without checking for offsets monotinicity.
Panics
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() - 1
. - The
data_type
’scrate::datatypes::PhysicalType
is not equal to eitherBinary
orLargeBinary
.
Safety
This function is unsafe iff:
- the offsets are not monotonically increasing
Implementation
This function is O(1)
sourcepub unsafe fn from_data_unchecked(
data_type: DataType,
offsets: Buffer<O>,
values: Buffer<u8>,
validity: Option<Bitmap>
) -> BinaryArray<O>
pub unsafe fn from_data_unchecked(
data_type: DataType,
offsets: Buffer<O>,
values: Buffer<u8>,
validity: Option<Bitmap>
) -> BinaryArray<O>
Alias for [new_unchecked
]
Safety
This function is unsafe iff:
- the offsets are not monotonically increasing
sourceimpl<O> BinaryArray<O> where
O: Offset,
impl<O> BinaryArray<O> where
O: Offset,
sourcepub fn slice(&self, offset: usize, length: usize) -> BinaryArray<O>
pub fn slice(&self, offset: usize, length: usize) -> BinaryArray<O>
Creates a new BinaryArray
by slicing this BinaryArray
.
Implementation
This function is O(1)
: all data will be shared between both arrays.
Panics
iff offset + length > self.len()
.
sourcepub unsafe fn slice_unchecked(
&self,
offset: usize,
length: usize
) -> BinaryArray<O>
pub unsafe fn slice_unchecked(
&self,
offset: usize,
length: usize
) -> BinaryArray<O>
Creates a new BinaryArray
by slicing this BinaryArray
.
Implementation
This function is O(1)
: all data will be shared between both arrays.
Safety
The caller must ensure that offset + length <= self.len()
.
sourcepub fn with_validity(&self, validity: Option<Bitmap>) -> BinaryArray<O>
pub fn with_validity(&self, validity: Option<Bitmap>) -> BinaryArray<O>
sourceimpl<O> BinaryArray<O> where
O: Offset,
impl<O> BinaryArray<O> where
O: Offset,
sourcepub fn value(&self, i: usize) -> &[u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
pub fn value(&self, i: usize) -> &[u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
sourcepub unsafe fn value_unchecked(&self, i: usize) -> &[u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
pub unsafe fn value_unchecked(&self, i: usize) -> &[u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
Trait Implementations
sourceimpl<O> Array for BinaryArray<O> where
O: Offset,
impl<O> Array for BinaryArray<O> where
O: Offset,
sourcefn data_type(&self) -> &DataType
fn data_type(&self) -> &DataType
The DataType
of the Array
. In combination with Array::as_any
, this can be
used to downcast trait objects (dyn Array
) to concrete arrays. Read more
sourceunsafe fn slice_unchecked(
&self,
offset: usize,
length: usize
) -> Box<dyn Array + 'static, Global>
unsafe fn slice_unchecked(
&self,
offset: usize,
length: usize
) -> Box<dyn Array + 'static, Global>
sourcefn null_count(&self) -> usize
fn null_count(&self) -> usize
sourceimpl<O> Clone for BinaryArray<O> where
O: Clone + Offset,
impl<O> Clone for BinaryArray<O> where
O: Clone + Offset,
sourcefn clone(&self) -> BinaryArray<O>
fn clone(&self) -> BinaryArray<O>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<O> Debug for BinaryArray<O> where
O: Offset,
impl<O> Debug for BinaryArray<O> where
O: Offset,
sourceimpl<'a, O> From<GrowableBinary<'a, O>> for BinaryArray<O> where
O: Offset,
impl<'a, O> From<GrowableBinary<'a, O>> for BinaryArray<O> where
O: Offset,
sourcefn from(val: GrowableBinary<'a, O>) -> BinaryArray<O>
fn from(val: GrowableBinary<'a, O>) -> BinaryArray<O>
Performs the conversion.
sourceimpl<O> From<MutableBinaryArray<O>> for BinaryArray<O> where
O: Offset,
impl<O> From<MutableBinaryArray<O>> for BinaryArray<O> where
O: Offset,
sourcefn from(other: MutableBinaryArray<O>) -> BinaryArray<O>
fn from(other: MutableBinaryArray<O>) -> BinaryArray<O>
Performs the conversion.
sourceimpl<O, P> FromIterator<Option<P>> for BinaryArray<O> where
O: Offset,
P: AsRef<[u8]>,
impl<O, P> FromIterator<Option<P>> for BinaryArray<O> where
O: Offset,
P: AsRef<[u8]>,
sourcefn from_iter<I>(iter: I) -> BinaryArray<O> where
I: IntoIterator<Item = Option<P>>,
fn from_iter<I>(iter: I) -> BinaryArray<O> where
I: IntoIterator<Item = Option<P>>,
Creates a value from an iterator. Read more
sourceimpl<O> GenericBinaryArray<O> for BinaryArray<O> where
O: Offset,
impl<O> GenericBinaryArray<O> for BinaryArray<O> where
O: Offset,
sourceimpl<'a, O> IntoIterator for &'a BinaryArray<O> where
O: Offset,
impl<'a, O> IntoIterator for &'a BinaryArray<O> where
O: Offset,
type IntoIter = ZipValidity<'a, &'a [u8], BinaryValueIter<'a, O>>
type IntoIter = ZipValidity<'a, &'a [u8], BinaryValueIter<'a, O>>
Which kind of iterator are we turning this into?
sourcefn into_iter(self) -> <&'a BinaryArray<O> as IntoIterator>::IntoIter
fn into_iter(self) -> <&'a BinaryArray<O> as IntoIterator>::IntoIter
Creates an iterator from a value. Read more
sourceimpl<'_, O> PartialEq<&'_ (dyn Array + '_)> for BinaryArray<O> where
O: Offset,
impl<'_, O> PartialEq<&'_ (dyn Array + '_)> for BinaryArray<O> where
O: Offset,
sourceimpl<O> PartialEq<BinaryArray<O>> for BinaryArray<O> where
O: Offset,
impl<O> PartialEq<BinaryArray<O>> for BinaryArray<O> where
O: Offset,
Auto Trait Implementations
impl<O> RefUnwindSafe for BinaryArray<O> where
O: RefUnwindSafe,
impl<O> Send for BinaryArray<O>
impl<O> Sync for BinaryArray<O>
impl<O> Unpin for BinaryArray<O>
impl<O> UnwindSafe for BinaryArray<O> where
O: RefUnwindSafe,
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
sourceimpl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<A> PolarsArray for A where
A: Array + ?Sized,
impl<A> PolarsArray for A where
A: Array + ?Sized,
fn has_validity(&self) -> bool
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more