arucil commented on issue #655:
URL: https://github.com/apache/arrow-rs/issues/655#issuecomment-898813445
I couldn't figure out how to add another `impl FromIterator` for
`PrimitiveArray`. At first I simply copy the impl block of
`FromIterator<Option<T>>` and delete `Option`,
```rust
impl<T: ArrowPrimitiveType, Ptr: Borrow<Option<<T as
ArrowPrimitiveType>::Native>>>
FromIterator<Ptr> for PrimitiveArray<T>
{ ... }
impl<T: ArrowPrimitiveType, Ptr: Borrow<<T as ArrowPrimitiveType>::Native>>
FromIterator<Ptr> for PrimitiveArray<T>
{ ... }
```
however this yields a
> conflicting implementations of trait `std::iter::FromIterator<_>` for type
`array::array_primitive::PrimitiveArray<_>`
error.
Then I changed `Option<T>` to an additional generic parameter `U:
Into<Option<T>>`,
```rust
impl<T: ArrowPrimitiveType, Ptr: Borrow<U>, U: Into<Option<T::Native>>>
FromIterator<Ptr> for PrimitiveArray<T>
{ ... }
```
This didn't work either. This yields a `the type parameter U is not
constrained by the impl trait, self type, or predicates` error.
Any help is appreciated.
--
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]