Downcasts a `dyn Array` to a concrete type ``` # use arrow_array::{BooleanArray, Int32Array, RecordBatch, StringArray}; # use arrow_array::cast::downcast_array; struct ConcreteBatch { col1: Int32Array, col2: BooleanArray, col3: StringArray, } impl ConcreteBatch { fn new(batch: &RecordBatch) -> Self { Self { col1: downcast_array(batch.column(0).as_ref()), col2: downcast_array(batch.column(1).as_r
(array: &dyn Array)
| 812 | /// |
| 813 | /// Panics if array is not of the correct data type |
| 814 | pub fn downcast_array<T>(array: &dyn Array) -> T |
| 815 | where |
| 816 | T: From<ArrayData>, |
| 817 | { |
| 818 | T::from(array.to_data()) |
| 819 | } |
| 820 | |
| 821 | mod private { |
| 822 | pub trait Sealed {} |