boustrophedon commented on issue #5714:
URL: https://github.com/apache/arrow-rs/issues/5714#issuecomment-2094466783
Sure, it's possible to write something like
```
trait ToArc {
fn arc(self) -> Arc<Self> {
Arc::new(self)
}
}
impl ToArc for Int32Array {} [...]
```
and impl it for the array types.
I took a quick look and it seems like there's 17 structs if we were to
implement it directly.
```
map_array.rs:impl Array for MapArray {
boolean_array.rs:impl Array for BooleanArray {
run_array.rs:impl<T: RunEndIndexType> Array for RunArray<T> {
run_array.rs:impl<'a, R: RunEndIndexType, V: Sync> Array for
TypedRunArray<'a, R, V> {
null_array.rs:impl Array for NullArray {
mod.rs:impl Array for ArrayRef {
mod.rs:impl<'a, T: Array> Array for &'a T {
struct_array.rs:impl Array for StructArray {
list_array.rs:impl<OffsetSize: OffsetSizeTrait> Array for
GenericListArray<OffsetSize> {
byte_view_array.rs:impl<T: ByteViewType + ?Sized> Array for
GenericByteViewArray<T> {
dictionary_array.rs:impl<T: ArrowDictionaryKeyType> Array for
DictionaryArray<T> {
dictionary_array.rs:impl<'a, K: ArrowDictionaryKeyType, V: Sync> Array for
TypedDictionaryArray<'a, K, V> {
byte_array.rs:impl<T: ByteArrayType> Array for GenericByteArray<T> {
fixed_size_list_array.rs:impl Array for FixedSizeListArray {
primitive_array.rs:impl<T: ArrowPrimitiveType> Array for PrimitiveArray<T> {
union_array.rs:impl Array for UnionArray {
fixed_size_binary_array.rs:impl Array for FixedSizeBinaryArray {
```
Although probably implementing it for ArrayRef is bad.
---
Additionally, `into` with Schema only kind of works because rust can't infer
the type if you're cloning it (to increment the refcount) at the point of use,
e.g. passing it into a function.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]