You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/08/17 01:06:59 UTC

[GitHub] [arrow-rs] carols10cents commented on issue #655: Allow `collect`ing from Values as well as `Option`

carols10cents commented on issue #655:
URL: https://github.com/apache/arrow-rs/issues/655#issuecomment-899917303


   So this doesn't work because specialization isn't done yet... the problem is that if these two trait implementations:
   
   ```
   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>
   { ... }
   ```
   
   were allowed, then someone could come along and add:
   
   ```
   impl Borrow<Option<i32>> for Integer32 { ... }
   impl Borrow<i32> for Integer32 { ... }
   ```
   
   and then Rust wouldn't know which `FromIterator` implementation to use. 
   
   @shepmaster helped with this answer; I only got as far as "I think it's specialization related, but I don't know why" ;) 
   
   He also pointed me to https://stackoverflow.com/questions/37347311/how-is-there-a-conflicting-implementation-of-from-when-using-a-generic-type, perhaps that will be of some help to someone.
   
   I'm working with @shepmaster on a way around this but we might not be able to finish it until Wednesday.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org