Trait arrow::array::AsArray

source ·
pub trait AsArray: Sealed {
Show 24 methods // Required methods fn as_boolean_opt(&self) -> Option<&BooleanArray>; fn as_primitive_opt<T>(&self) -> Option<&PrimitiveArray<T>> where T: ArrowPrimitiveType; fn as_bytes_opt<T>(&self) -> Option<&GenericByteArray<T>> where T: ByteArrayType; fn as_struct_opt(&self) -> Option<&StructArray>; fn as_list_opt<O>(&self) -> Option<&GenericListArray<O>> where O: OffsetSizeTrait; fn as_fixed_size_binary_opt(&self) -> Option<&FixedSizeBinaryArray>; fn as_fixed_size_list_opt(&self) -> Option<&FixedSizeListArray>; fn as_map_opt(&self) -> Option<&MapArray>; fn as_dictionary_opt<K>(&self) -> Option<&DictionaryArray<K>> where K: ArrowDictionaryKeyType; fn as_any_dictionary_opt(&self) -> Option<&dyn AnyDictionaryArray>; // Provided methods fn as_boolean(&self) -> &BooleanArray { ... } fn as_primitive<T>(&self) -> &PrimitiveArray<T> where T: ArrowPrimitiveType { ... } fn as_bytes<T>(&self) -> &GenericByteArray<T> where T: ByteArrayType { ... } fn as_string_opt<O>( &self, ) -> Option<&GenericByteArray<GenericStringType<O>>> where O: OffsetSizeTrait { ... } fn as_string<O>(&self) -> &GenericByteArray<GenericStringType<O>> where O: OffsetSizeTrait { ... } fn as_binary_opt<O>( &self, ) -> Option<&GenericByteArray<GenericBinaryType<O>>> where O: OffsetSizeTrait { ... } fn as_binary<O>(&self) -> &GenericByteArray<GenericBinaryType<O>> where O: OffsetSizeTrait { ... } fn as_struct(&self) -> &StructArray { ... } fn as_list<O>(&self) -> &GenericListArray<O> where O: OffsetSizeTrait { ... } fn as_fixed_size_binary(&self) -> &FixedSizeBinaryArray { ... } fn as_fixed_size_list(&self) -> &FixedSizeListArray { ... } fn as_map(&self) -> &MapArray { ... } fn as_dictionary<K>(&self) -> &DictionaryArray<K> where K: ArrowDictionaryKeyType { ... } fn as_any_dictionary(&self) -> &dyn AnyDictionaryArray { ... }
}
Expand description

An extension trait for dyn Array that provides ergonomic downcasting

let col = Arc::new(Int32Array::from(vec![1, 2, 3])) as ArrayRef;
assert_eq!(col.as_primitive::<Int32Type>().values(), &[1, 2, 3]);

Required Methods§

source

fn as_boolean_opt(&self) -> Option<&BooleanArray>

Downcast this to a BooleanArray returning None if not possible

source

fn as_primitive_opt<T>(&self) -> Option<&PrimitiveArray<T>>

Downcast this to a PrimitiveArray returning None if not possible

source

fn as_bytes_opt<T>(&self) -> Option<&GenericByteArray<T>>
where T: ByteArrayType,

Downcast this to a GenericByteArray returning None if not possible

source

fn as_struct_opt(&self) -> Option<&StructArray>

Downcast this to a StructArray returning None if not possible

source

fn as_list_opt<O>(&self) -> Option<&GenericListArray<O>>
where O: OffsetSizeTrait,

Downcast this to a GenericListArray returning None if not possible

source

fn as_fixed_size_binary_opt(&self) -> Option<&FixedSizeBinaryArray>

Downcast this to a FixedSizeBinaryArray returning None if not possible

source

fn as_fixed_size_list_opt(&self) -> Option<&FixedSizeListArray>

Downcast this to a FixedSizeListArray returning None if not possible

source

fn as_map_opt(&self) -> Option<&MapArray>

Downcast this to a MapArray returning None if not possible

source

fn as_dictionary_opt<K>(&self) -> Option<&DictionaryArray<K>>

Downcast this to a DictionaryArray returning None if not possible

source

fn as_any_dictionary_opt(&self) -> Option<&dyn AnyDictionaryArray>

Downcasts this to a AnyDictionaryArray returning None if not possible

Provided Methods§

source

fn as_boolean(&self) -> &BooleanArray

Downcast this to a BooleanArray panicking if not possible

source

fn as_primitive<T>(&self) -> &PrimitiveArray<T>

Downcast this to a PrimitiveArray panicking if not possible

source

fn as_bytes<T>(&self) -> &GenericByteArray<T>
where T: ByteArrayType,

Downcast this to a GenericByteArray panicking if not possible

source

fn as_string_opt<O>(&self) -> Option<&GenericByteArray<GenericStringType<O>>>
where O: OffsetSizeTrait,

Downcast this to a GenericStringArray returning None if not possible

source

fn as_string<O>(&self) -> &GenericByteArray<GenericStringType<O>>
where O: OffsetSizeTrait,

Downcast this to a GenericStringArray panicking if not possible

source

fn as_binary_opt<O>(&self) -> Option<&GenericByteArray<GenericBinaryType<O>>>
where O: OffsetSizeTrait,

Downcast this to a GenericBinaryArray returning None if not possible

source

fn as_binary<O>(&self) -> &GenericByteArray<GenericBinaryType<O>>
where O: OffsetSizeTrait,

Downcast this to a GenericBinaryArray panicking if not possible

source

fn as_struct(&self) -> &StructArray

Downcast this to a StructArray panicking if not possible

source

fn as_list<O>(&self) -> &GenericListArray<O>
where O: OffsetSizeTrait,

Downcast this to a GenericListArray panicking if not possible

source

fn as_fixed_size_binary(&self) -> &FixedSizeBinaryArray

Downcast this to a FixedSizeBinaryArray panicking if not possible

source

fn as_fixed_size_list(&self) -> &FixedSizeListArray

Downcast this to a FixedSizeListArray panicking if not possible

source

fn as_map(&self) -> &MapArray

Downcast this to a MapArray panicking if not possible

source

fn as_dictionary<K>(&self) -> &DictionaryArray<K>

Downcast this to a DictionaryArray panicking if not possible

source

fn as_any_dictionary(&self) -> &dyn AnyDictionaryArray

Downcasts this to a AnyDictionaryArray panicking if not possible

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl AsArray for Arc<dyn Array>

Implementors§

source§

impl AsArray for dyn Array + '_