Struct arrow::array::FixedSizeBinaryArray
source · [−]pub struct FixedSizeBinaryArray { /* private fields */ }
Expand description
An array where each element is a fixed-size sequence of bytes.
Examples
Create an array from an iterable argument of byte slices.
use arrow::array::{Array, FixedSizeBinaryArray};
let input_arg = vec![ vec![1, 2], vec![3, 4], vec![5, 6] ];
let arr = FixedSizeBinaryArray::try_from_iter(input_arg.into_iter()).unwrap();
assert_eq!(3, arr.len());
Create an array from an iterable argument of sparse byte slices.
Sparsity means that the input argument can contain None
items.
use arrow::array::{Array, FixedSizeBinaryArray};
let input_arg = vec![ None, Some(vec![7, 8]), Some(vec![9, 10]), None, Some(vec![13, 14]) ];
let arr = FixedSizeBinaryArray::try_from_sparse_iter(input_arg.into_iter()).unwrap();
assert_eq!(5, arr.len())
Implementations
sourceimpl FixedSizeBinaryArray
impl FixedSizeBinaryArray
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]
Returns the element at index i
as a byte slice.
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]
Returns the element at index i
as a byte slice.
Safety
Caller is responsible for ensuring that the index is within the bounds of the array
sourcepub fn value_offset(&self, i: usize) -> i32
pub fn value_offset(&self, i: usize) -> i32
Returns the offset for the element at index i
.
Note this doesn’t do any bound checking, for performance reason.
sourcepub fn value_length(&self) -> i32
pub fn value_length(&self) -> i32
Returns the length for an element.
All elements have the same length as the array is a fixed size.
sourcepub fn value_data(&self) -> Buffer
pub fn value_data(&self) -> Buffer
Returns a clone of the value data buffer
sourcepub fn try_from_sparse_iter<T, U>(iter: T) -> Result<Self> where
T: Iterator<Item = Option<U>>,
U: AsRef<[u8]>,
pub fn try_from_sparse_iter<T, U>(iter: T) -> Result<Self> where
T: Iterator<Item = Option<U>>,
U: AsRef<[u8]>,
Create an array from an iterable argument of sparse byte slices.
Sparsity means that items returned by the iterator are optional, i.e input argument can
contain None
items.
Examples
use arrow::array::FixedSizeBinaryArray;
let input_arg = vec![
None,
Some(vec![7, 8]),
Some(vec![9, 10]),
None,
Some(vec![13, 14]),
None,
];
let array = FixedSizeBinaryArray::try_from_sparse_iter(input_arg.into_iter()).unwrap();
Errors
Returns error if argument has length zero, or sizes of nested slices don’t match.
sourcepub fn try_from_iter<T, U>(iter: T) -> Result<Self> where
T: Iterator<Item = U>,
U: AsRef<[u8]>,
pub fn try_from_iter<T, U>(iter: T) -> Result<Self> where
T: Iterator<Item = U>,
U: AsRef<[u8]>,
Create an array from an iterable argument of byte slices.
Examples
use arrow::array::FixedSizeBinaryArray;
let input_arg = vec![
vec![1, 2],
vec![3, 4],
vec![5, 6],
];
let array = FixedSizeBinaryArray::try_from_iter(input_arg.into_iter()).unwrap();
Errors
Returns error if argument has length zero, or sizes of nested slices don’t match.
Trait Implementations
sourceimpl Array for FixedSizeBinaryArray
impl Array for FixedSizeBinaryArray
sourcefn data_ref(&self) -> &ArrayData
fn data_ref(&self) -> &ArrayData
Returns a reference-counted pointer to the underlying data of this array.
sourcefn slice(&self, offset: usize, length: usize) -> ArrayRef
fn slice(&self, offset: usize, length: usize) -> ArrayRef
Returns a zero-copy slice of this array with the indicated offset and length. Read more
sourcefn offset(&self) -> usize
fn offset(&self) -> usize
Returns the offset into the underlying data used by this array(-slice).
Note that the underlying data can be shared by many arrays.
This defaults to 0
. Read more
sourcefn is_null(&self, index: usize) -> bool
fn is_null(&self, index: usize) -> bool
Returns whether the element at index
is null.
When using this function on a slice, the index is relative to the slice. Read more
sourcefn is_valid(&self, index: usize) -> bool
fn is_valid(&self, index: usize) -> bool
Returns whether the element at index
is not null.
When using this function on a slice, the index is relative to the slice. Read more
sourcefn null_count(&self) -> usize
fn null_count(&self) -> usize
Returns the total number of null values in this array. Read more
sourcefn get_buffer_memory_size(&self) -> usize
fn get_buffer_memory_size(&self) -> usize
Returns the total number of bytes of memory pointed to by this array. The buffers store bytes in the Arrow memory format, and include the data as well as the validity map. Read more
sourcefn get_array_memory_size(&self) -> usize
fn get_array_memory_size(&self) -> usize
Returns the total number of bytes of memory occupied physically by this array.
This value will always be greater than returned by get_buffer_memory_size()
and
includes the overhead of the data structures that contain the pointers to the various buffers. Read more
sourcefn to_raw(&self) -> Result<(*const FFI_ArrowArray, *const FFI_ArrowSchema)>
fn to_raw(&self) -> Result<(*const FFI_ArrowArray, *const FFI_ArrowSchema)>
returns two pointers that represent this array in the C Data Interface (FFI)
sourceimpl Debug for FixedSizeBinaryArray
impl Debug for FixedSizeBinaryArray
sourceimpl From<ArrayData> for FixedSizeBinaryArray
impl From<ArrayData> for FixedSizeBinaryArray
sourceimpl From<FixedSizeListArray> for FixedSizeBinaryArray
impl From<FixedSizeListArray> for FixedSizeBinaryArray
Creates a FixedSizeBinaryArray
from FixedSizeList<u8>
array
sourcefn from(v: FixedSizeListArray) -> Self
fn from(v: FixedSizeListArray) -> Self
Converts to this type from the input type.
sourceimpl JsonEqual for FixedSizeBinaryArray
impl JsonEqual for FixedSizeBinaryArray
sourcefn equals_json(&self, json: &[&Value]) -> bool
fn equals_json(&self, json: &[&Value]) -> bool
Checks whether arrow array equals to json array.
sourcefn equals_json_values(&self, json: &[Value]) -> bool
fn equals_json_values(&self, json: &[Value]) -> bool
Checks whether arrow array equals to json array.
sourceimpl PartialEq<FixedSizeBinaryArray> for Value
impl PartialEq<FixedSizeBinaryArray> for Value
Auto Trait Implementations
impl RefUnwindSafe for FixedSizeBinaryArray
impl Send for FixedSizeBinaryArray
impl Sync for FixedSizeBinaryArray
impl Unpin for FixedSizeBinaryArray
impl UnwindSafe for FixedSizeBinaryArray
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