macro_rules! downcast_run_array {
($values:ident => $e:expr, $($p:pat => $fallback:expr $(,)*)*) => { ... };
($values:ident => $e:block $($p:pat => $fallback:expr $(,)*)*) => { ... };
}
Expand description
Downcast an Array
to a RunArray
based on its DataType
, accepts
a number of subsequent patterns to match the data type
fn print_strings(array: &dyn Array) {
downcast_run_array!(
array => match array.values().data_type() {
DataType::Utf8 => {
for v in array.downcast::<StringArray>().unwrap() {
println!("{:?}", v);
}
}
t => println!("Unsupported run array value type {}", t),
},
DataType::Utf8 => {
for v in as_string_array(array) {
println!("{:?}", v);
}
}
t => println!("Unsupported datatype {}", t)
)
}