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) to usize are valid slices of values.
  • len is equal to validity.len(), when defined.

Implementations

Returns an iterator of Option<&[u8]>

Returns an iterator of &[u8]

Creates a new BinaryArray from slices of &[u8].

Creates a new BinaryArray from a slice of optional &[u8].

Creates a BinaryArray from an iterator of trusted length.

Creates a new BinaryArray from a Iterator of &str.

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.

Creates a BinaryArray from an iterator of trusted length.

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.

Creates a BinaryArray from an fallible iterator of trusted length.

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’s crate::datatypes::PhysicalType is not equal to either Binary or LargeBinary.
Implementation

This function is O(N) - checking monotinicity is O(N)

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’s crate::datatypes::PhysicalType is not equal to either Binary or LargeBinary.
Implementation

This function is O(N) - checking monotinicity is O(N)

Alias for new

Creates an empty BinaryArray, i.e. whose .len is zero.

Creates an null BinaryArray, i.e. whose .null_count() == .len().

Returns the default DataType, DataType::Binary or DataType::LargeBinary

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’s crate::datatypes::PhysicalType is not equal to either Binary or LargeBinary.
Safety

This function is unsafe iff:

  • the offsets are not monotonically increasing
Implementation

This function is O(1)

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’s crate::datatypes::PhysicalType is not equal to either Binary or LargeBinary.
Safety

This function is unsafe iff:

  • the offsets are not monotonically increasing
Implementation

This function is O(1)

Alias for [new_unchecked]

Safety

This function is unsafe iff:

  • the offsets are not monotonically increasing

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().

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().

Clones this BinaryArray with a different validity.

Panic

Panics iff validity.len() != self.len().

Returns the length of this array

Returns the element at index i

Panics

iff i >= self.len()

Returns the element at index i

Safety

Assumes that the i < self.len.

The optional validity.

Returns the offsets that slice .values() to return valid values.

Returns all values in this array. Use .offsets() to slice them.

Trait Implementations

Convert to trait object.

The length of the Array. Every array has a length corresponding to the number of elements (slots). Read more

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

The validity of the Array: every array has an optional Bitmap that, when available specifies whether the array slot is valid or not (null). When the validity is None, all slots are valid. Read more

Slices the Array, returning a new Box<dyn Array>. Read more

Slices the Array, returning a new Box<dyn Array>. Read more

Sets the validity bitmap on this Array. Read more

Clone a &dyn Array to an owned Box<dyn Array>.

whether the array is empty

The number of null slots on this Array. Read more

Returns whether slot i is null. Read more

Returns whether slot i is valid. Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Creates a value from an iterator. Read more

The values of the array

The offsets of the array

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.