pub trait AsArray: Sealed {
Show 36 methods
// Required methods
fn as_boolean_opt(&self) -> Option<&BooleanArray>;
fn as_primitive_opt<T: ArrowPrimitiveType>(
&self,
) -> Option<&PrimitiveArray<T>>;
fn as_bytes_opt<T: ByteArrayType>(&self) -> Option<&GenericByteArray<T>>;
fn as_byte_view_opt<T: ByteViewType>(
&self,
) -> Option<&GenericByteViewArray<T>>;
fn as_struct_opt(&self) -> Option<&StructArray>;
fn as_union_opt(&self) -> Option<&UnionArray>;
fn as_list_opt<O: OffsetSizeTrait>(&self) -> Option<&GenericListArray<O>>;
fn as_list_view_opt<O: OffsetSizeTrait>(
&self,
) -> Option<&GenericListViewArray<O>>;
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: ArrowDictionaryKeyType>(
&self,
) -> Option<&DictionaryArray<K>>;
fn as_run_opt<K: RunEndIndexType>(&self) -> Option<&RunArray<K>>;
fn as_any_dictionary_opt(&self) -> Option<&dyn AnyDictionaryArray>;
// Provided methods
fn as_boolean(&self) -> &BooleanArray { ... }
fn as_primitive<T: ArrowPrimitiveType>(&self) -> &PrimitiveArray<T> { ... }
fn as_bytes<T: ByteArrayType>(&self) -> &GenericByteArray<T> { ... }
fn as_string_opt<O: OffsetSizeTrait>(
&self,
) -> Option<&GenericStringArray<O>> { ... }
fn as_string<O: OffsetSizeTrait>(&self) -> &GenericStringArray<O> { ... }
fn as_binary_opt<O: OffsetSizeTrait>(
&self,
) -> Option<&GenericBinaryArray<O>> { ... }
fn as_binary<O: OffsetSizeTrait>(&self) -> &GenericBinaryArray<O> { ... }
fn as_string_view_opt(&self) -> Option<&StringViewArray> { ... }
fn as_string_view(&self) -> &StringViewArray { ... }
fn as_binary_view_opt(&self) -> Option<&BinaryViewArray> { ... }
fn as_binary_view(&self) -> &BinaryViewArray { ... }
fn as_byte_view<T: ByteViewType>(&self) -> &GenericByteViewArray<T> { ... }
fn as_struct(&self) -> &StructArray { ... }
fn as_union(&self) -> &UnionArray { ... }
fn as_list<O: OffsetSizeTrait>(&self) -> &GenericListArray<O> { ... }
fn as_list_view<O: OffsetSizeTrait>(&self) -> &GenericListViewArray<O> { ... }
fn as_fixed_size_binary(&self) -> &FixedSizeBinaryArray { ... }
fn as_fixed_size_list(&self) -> &FixedSizeListArray { ... }
fn as_map(&self) -> &MapArray { ... }
fn as_dictionary<K: ArrowDictionaryKeyType>(&self) -> &DictionaryArray<K> { ... }
fn as_run<K: RunEndIndexType>(&self) -> &RunArray<K> { ... }
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§
Sourcefn as_boolean_opt(&self) -> Option<&BooleanArray>
fn as_boolean_opt(&self) -> Option<&BooleanArray>
Downcast this to a BooleanArray returning None if not possible
Sourcefn as_primitive_opt<T: ArrowPrimitiveType>(&self) -> Option<&PrimitiveArray<T>>
fn as_primitive_opt<T: ArrowPrimitiveType>(&self) -> Option<&PrimitiveArray<T>>
Downcast this to a PrimitiveArray returning None if not possible
Sourcefn as_bytes_opt<T: ByteArrayType>(&self) -> Option<&GenericByteArray<T>>
fn as_bytes_opt<T: ByteArrayType>(&self) -> Option<&GenericByteArray<T>>
Downcast this to a GenericByteArray returning None if not possible
Sourcefn as_byte_view_opt<T: ByteViewType>(&self) -> Option<&GenericByteViewArray<T>>
fn as_byte_view_opt<T: ByteViewType>(&self) -> Option<&GenericByteViewArray<T>>
Downcast this to a GenericByteViewArray returning None if not possible
Sourcefn as_struct_opt(&self) -> Option<&StructArray>
fn as_struct_opt(&self) -> Option<&StructArray>
Downcast this to a StructArray returning None if not possible
Sourcefn as_union_opt(&self) -> Option<&UnionArray>
fn as_union_opt(&self) -> Option<&UnionArray>
Downcast this to a UnionArray returning None if not possible
Sourcefn as_list_opt<O: OffsetSizeTrait>(&self) -> Option<&GenericListArray<O>>
fn as_list_opt<O: OffsetSizeTrait>(&self) -> Option<&GenericListArray<O>>
Downcast this to a GenericListArray returning None if not possible
Sourcefn as_list_view_opt<O: OffsetSizeTrait>(
&self,
) -> Option<&GenericListViewArray<O>>
fn as_list_view_opt<O: OffsetSizeTrait>( &self, ) -> Option<&GenericListViewArray<O>>
Downcast this to a GenericListViewArray returning None if not possible
Sourcefn as_fixed_size_binary_opt(&self) -> Option<&FixedSizeBinaryArray>
fn as_fixed_size_binary_opt(&self) -> Option<&FixedSizeBinaryArray>
Downcast this to a FixedSizeBinaryArray returning None if not possible
Sourcefn as_fixed_size_list_opt(&self) -> Option<&FixedSizeListArray>
fn as_fixed_size_list_opt(&self) -> Option<&FixedSizeListArray>
Downcast this to a FixedSizeListArray returning None if not possible
Sourcefn as_map_opt(&self) -> Option<&MapArray>
fn as_map_opt(&self) -> Option<&MapArray>
Downcast this to a MapArray returning None if not possible
Sourcefn as_dictionary_opt<K: ArrowDictionaryKeyType>(
&self,
) -> Option<&DictionaryArray<K>>
fn as_dictionary_opt<K: ArrowDictionaryKeyType>( &self, ) -> Option<&DictionaryArray<K>>
Downcast this to a DictionaryArray returning None if not possible
Sourcefn as_run_opt<K: RunEndIndexType>(&self) -> Option<&RunArray<K>>
fn as_run_opt<K: RunEndIndexType>(&self) -> Option<&RunArray<K>>
Downcast this to a RunArray returning None if not possible
Sourcefn as_any_dictionary_opt(&self) -> Option<&dyn AnyDictionaryArray>
fn as_any_dictionary_opt(&self) -> Option<&dyn AnyDictionaryArray>
Downcasts this to a AnyDictionaryArray returning None if not possible
Provided Methods§
Sourcefn as_boolean(&self) -> &BooleanArray
fn as_boolean(&self) -> &BooleanArray
Downcast this to a BooleanArray panicking if not possible
Sourcefn as_primitive<T: ArrowPrimitiveType>(&self) -> &PrimitiveArray<T>
fn as_primitive<T: ArrowPrimitiveType>(&self) -> &PrimitiveArray<T>
Downcast this to a PrimitiveArray panicking if not possible
Sourcefn as_bytes<T: ByteArrayType>(&self) -> &GenericByteArray<T>
fn as_bytes<T: ByteArrayType>(&self) -> &GenericByteArray<T>
Downcast this to a GenericByteArray panicking if not possible
Sourcefn as_string_opt<O: OffsetSizeTrait>(&self) -> Option<&GenericStringArray<O>>
fn as_string_opt<O: OffsetSizeTrait>(&self) -> Option<&GenericStringArray<O>>
Downcast this to a GenericStringArray returning None if not possible
Sourcefn as_string<O: OffsetSizeTrait>(&self) -> &GenericStringArray<O>
fn as_string<O: OffsetSizeTrait>(&self) -> &GenericStringArray<O>
Downcast this to a GenericStringArray panicking if not possible
Sourcefn as_binary_opt<O: OffsetSizeTrait>(&self) -> Option<&GenericBinaryArray<O>>
fn as_binary_opt<O: OffsetSizeTrait>(&self) -> Option<&GenericBinaryArray<O>>
Downcast this to a GenericBinaryArray returning None if not possible
Sourcefn as_binary<O: OffsetSizeTrait>(&self) -> &GenericBinaryArray<O>
fn as_binary<O: OffsetSizeTrait>(&self) -> &GenericBinaryArray<O>
Downcast this to a GenericBinaryArray panicking if not possible
Sourcefn as_string_view_opt(&self) -> Option<&StringViewArray>
fn as_string_view_opt(&self) -> Option<&StringViewArray>
Downcast this to a StringViewArray returning None if not possible
Sourcefn as_string_view(&self) -> &StringViewArray
fn as_string_view(&self) -> &StringViewArray
Downcast this to a StringViewArray panicking if not possible
Sourcefn as_binary_view_opt(&self) -> Option<&BinaryViewArray>
fn as_binary_view_opt(&self) -> Option<&BinaryViewArray>
Downcast this to a BinaryViewArray returning None if not possible
Sourcefn as_binary_view(&self) -> &BinaryViewArray
fn as_binary_view(&self) -> &BinaryViewArray
Downcast this to a BinaryViewArray panicking if not possible
Sourcefn as_byte_view<T: ByteViewType>(&self) -> &GenericByteViewArray<T>
fn as_byte_view<T: ByteViewType>(&self) -> &GenericByteViewArray<T>
Downcast this to a GenericByteViewArray panicking if not possible
Sourcefn as_struct(&self) -> &StructArray
fn as_struct(&self) -> &StructArray
Downcast this to a StructArray panicking if not possible
Sourcefn as_union(&self) -> &UnionArray
fn as_union(&self) -> &UnionArray
Downcast this to a UnionArray panicking if not possible
Sourcefn as_list<O: OffsetSizeTrait>(&self) -> &GenericListArray<O>
fn as_list<O: OffsetSizeTrait>(&self) -> &GenericListArray<O>
Downcast this to a GenericListArray panicking if not possible
Sourcefn as_list_view<O: OffsetSizeTrait>(&self) -> &GenericListViewArray<O>
fn as_list_view<O: OffsetSizeTrait>(&self) -> &GenericListViewArray<O>
Downcast this to a GenericListViewArray panicking if not possible
Sourcefn as_fixed_size_binary(&self) -> &FixedSizeBinaryArray
fn as_fixed_size_binary(&self) -> &FixedSizeBinaryArray
Downcast this to a FixedSizeBinaryArray panicking if not possible
Sourcefn as_fixed_size_list(&self) -> &FixedSizeListArray
fn as_fixed_size_list(&self) -> &FixedSizeListArray
Downcast this to a FixedSizeListArray panicking if not possible
Sourcefn as_dictionary<K: ArrowDictionaryKeyType>(&self) -> &DictionaryArray<K>
fn as_dictionary<K: ArrowDictionaryKeyType>(&self) -> &DictionaryArray<K>
Downcast this to a DictionaryArray panicking if not possible
Sourcefn as_run<K: RunEndIndexType>(&self) -> &RunArray<K>
fn as_run<K: RunEndIndexType>(&self) -> &RunArray<K>
Downcast this to a RunArray panicking if not possible
Sourcefn as_any_dictionary(&self) -> &dyn AnyDictionaryArray
fn as_any_dictionary(&self) -> &dyn AnyDictionaryArray
Downcasts this to a AnyDictionaryArray panicking if not possible
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.