alamb opened a new issue #1128:
URL: https://github.com/apache/arrow-rs/issues/1128
**Is your feature request related to a problem or challenge? Please describe
what you are trying to do.**
Basically, the issue is that I want to treat `ArrayRef` / `Arc<dyn Array>`
directly as `&dyn Array` so they can be passed directly to compute kernels and
other things that do dynamic type dispatch without having to call
`array.as_ref()`
Here is a good example"
```rust
fn compute_my_thing(arr: &dyn Array) -> bool {
arr.len() > 0
}
fn test() {
let arr: Int32Array = vec![1,2,3].into_iter().map(Some).collect();
// works well!
compute_my_thing(&arr);
// however, when wrapped as an ArrayRef, does not work:
//
// 3615 | compute_my_thing(&arr);
// | ---------------- ^^^^ the trait `array::array::Array`
is not implemented for `std::sync::Arc<(dyn array::array::Array + 'static)>`
// | |
// | required by a bound introduced by this call
let arr: ArrayRef = Arc::new(arr);
//compute_my_thing(&arr);
// Today the workaround is to call `as_ref()`, which works, but is
annoying:
compute_my_thing(arr.as_ref());
}
```
**Describe the solution you'd like**
```rust
impl Array for ArrayRef {
...
}
impl Array for &ArrayRef {
...
}
```
**Describe alternatives you've considered**
I would love alternate ideas
**Additional context**
In the context of https://github.com/apache/arrow-rs/pull/1127 (but I have
hit this previously as well).
--
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]