macro_rules! downcast_temporal_array { ($values:ident => $e:expr, $($p:pat => $fallback:expr $(,)*)*) => { ... }; (($($values:ident),+) => $e:expr, $($p:pat => $fallback:expr $(,)*)*) => { ... }; ($($values:ident),+ => $e:block $($p:pat => $fallback:expr $(,)*)*) => { ... }; (($($values:ident),+) => $e:block $($p:pat => $fallback:expr $(,)*)*) => { ... }; }
Expand description
Downcast an Array
to a temporal PrimitiveArray
based on its DataType
accepts a number of subsequent patterns to match the data type
fn print_temporal(array: &dyn Array) {
downcast_temporal_array!(
array => {
for v in array {
println!("{:?}", v);
}
}
DataType::Utf8 => {
for v in as_string_array(array) {
println!("{:?}", v);
}
}
t => println!("Unsupported datatype {}", t)
)
}