Struct arrow2::array::FixedSizeBinaryArray
source · pub struct FixedSizeBinaryArray { /* private fields */ }
Expand description
The Arrow’s equivalent to an immutable Vec<Option<[u8; size]>>
.
Cloning and slicing this struct is O(1)
.
Implementations§
source§impl<'a> FixedSizeBinaryArray
impl<'a> FixedSizeBinaryArray
sourcepub fn iter(
&'a self
) -> ZipValidity<&'a [u8], ChunksExact<'a, u8>, BitmapIter<'a>> ⓘ
pub fn iter( &'a self ) -> ZipValidity<&'a [u8], ChunksExact<'a, u8>, BitmapIter<'a>> ⓘ
constructs a new iterator
sourcepub fn values_iter(&'a self) -> ChunksExact<'a, u8>
pub fn values_iter(&'a self) -> ChunksExact<'a, u8>
Returns iterator over the values of FixedSizeBinaryArray
source§impl FixedSizeBinaryArray
impl FixedSizeBinaryArray
sourcepub fn try_new(
data_type: DataType,
values: Buffer<u8>,
validity: Option<Bitmap>
) -> Result<Self, Error>
pub fn try_new( data_type: DataType, values: Buffer<u8>, validity: Option<Bitmap> ) -> Result<Self, Error>
Creates a new FixedSizeBinaryArray
.
§Errors
This function returns an error iff:
- The
data_type
’s physical type is notcrate::datatypes::PhysicalType::FixedSizeBinary
- The length of
values
is not a multiple ofsize
indata_type
- the validity’s length is not equal to
values.len() / size
.
sourcepub fn new(
data_type: DataType,
values: Buffer<u8>,
validity: Option<Bitmap>
) -> Self
pub fn new( data_type: DataType, values: Buffer<u8>, validity: Option<Bitmap> ) -> Self
Creates a new FixedSizeBinaryArray
.
§Panics
This function panics iff:
- The
data_type
’s physical type is notcrate::datatypes::PhysicalType::FixedSizeBinary
- The length of
values
is not a multiple ofsize
indata_type
- the validity’s length is not equal to
values.len() / size
.
sourcepub fn new_empty(data_type: DataType) -> Self
pub fn new_empty(data_type: DataType) -> Self
Returns a new empty FixedSizeBinaryArray
.
sourcepub fn new_null(data_type: DataType, length: usize) -> Self
pub fn new_null(data_type: DataType, length: usize) -> Self
Returns a new null FixedSizeBinaryArray
.
sourcepub fn boxed(self) -> Box<dyn Array>
pub fn boxed(self) -> Box<dyn Array>
Boxes self into a Box<dyn Array>
.
sourcepub fn arced(self) -> Arc<dyn Array>
pub fn arced(self) -> Arc<dyn Array>
Boxes self into a std::sync::Arc<dyn Array>
.
source§impl FixedSizeBinaryArray
impl FixedSizeBinaryArray
sourcepub fn slice(&self, offset: usize, length: usize) -> Self
pub fn slice(&self, offset: usize, length: usize) -> Self
Returns a slice of this FixedSizeBinaryArray
.
§Implementation
This operation is O(1)
as it amounts to increase 3 ref counts.
§Panics
panics iff offset + length > self.len()
sourcepub unsafe fn slice_unchecked(&self, offset: usize, length: usize) -> Self
pub unsafe fn slice_unchecked(&self, offset: usize, length: usize) -> Self
Returns a slice of this FixedSizeBinaryArray
.
§Implementation
This operation is O(1)
as it amounts to increase 3 ref counts.
§Safety
The caller must ensure that offset + length <= self.len()
.
sourcepub fn with_validity(self, validity: Option<Bitmap>) -> Self
pub fn with_validity(self, validity: Option<Bitmap>) -> Self
Returns this FixedSizeBinaryArray
with a new validity.
§Panic
This function panics iff validity.len() != self.len()
.
sourcepub fn set_validity(&mut self, validity: Option<Bitmap>)
pub fn set_validity(&mut self, validity: Option<Bitmap>)
Sets the validity of this FixedSizeBinaryArray
.
§Panics
This function panics iff validity.len() != self.len()
.
source§impl FixedSizeBinaryArray
impl FixedSizeBinaryArray
sourcepub fn values(&self) -> &Buffer<u8>
pub fn values(&self) -> &Buffer<u8>
Returns the values allocated on this FixedSizeBinaryArray
.
sourcepub unsafe fn value_unchecked(&self, i: usize) -> &[u8] ⓘ
pub unsafe fn value_unchecked(&self, i: usize) -> &[u8] ⓘ
sourcepub fn to(self, data_type: DataType) -> Self
pub fn to(self, data_type: DataType) -> Self
Returns a new FixedSizeBinaryArray
with a different logical type.
This is O(1)
.
§Panics
Panics iff the data_type is not supported for the physical type.
source§impl FixedSizeBinaryArray
impl FixedSizeBinaryArray
sourcepub fn try_from_iter<P: AsRef<[u8]>, I: IntoIterator<Item = Option<P>>>(
iter: I,
size: usize
) -> Result<Self, Error>
pub fn try_from_iter<P: AsRef<[u8]>, I: IntoIterator<Item = Option<P>>>( iter: I, size: usize ) -> Result<Self, Error>
Creates a FixedSizeBinaryArray
from an fallible iterator of optional [u8]
.
sourcepub fn from_iter<P: AsRef<[u8]>, I: IntoIterator<Item = Option<P>>>(
iter: I,
size: usize
) -> Self
pub fn from_iter<P: AsRef<[u8]>, I: IntoIterator<Item = Option<P>>>( iter: I, size: usize ) -> Self
Creates a FixedSizeBinaryArray
from an iterator of optional [u8]
.
sourcepub fn from_slice<const N: usize, P: AsRef<[[u8; N]]>>(a: P) -> Self
pub fn from_slice<const N: usize, P: AsRef<[[u8; N]]>>(a: P) -> Self
Creates a FixedSizeBinaryArray
from a slice of arrays of bytes
Trait Implementations§
source§impl Array for FixedSizeBinaryArray
impl Array for FixedSizeBinaryArray
source§fn as_any(&self) -> &dyn Any
fn as_any(&self) -> &dyn Any
Any
, which enables downcasting to concrete types.source§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Any
, which enables mutable downcasting to concrete types.source§fn len(&self) -> usize
fn len(&self) -> usize
Array
. Every array has a length corresponding to the number of
elements (slots).source§fn data_type(&self) -> &DataType
fn data_type(&self) -> &DataType
DataType
of the Array
. In combination with Array::as_any
, this can be
used to downcast trait objects (dyn Array
) to concrete arrays.source§impl Clone for FixedSizeBinaryArray
impl Clone for FixedSizeBinaryArray
source§fn clone(&self) -> FixedSizeBinaryArray
fn clone(&self) -> FixedSizeBinaryArray
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more