You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Variant] Reverse VariantAsPrimitive trait to PrimitiveFromVariant (#8519)
# Which issue does this PR close?
- Relates to #8515
- Relates to #8516
# Rationale for this change
The existing `VariantAsPrimitive` trait is kind of "backward" and
requires very complex type bounds to use, e.g.:
```rust
impl<'a, T> VariantToPrimitiveArrowRowBuilder<'a, T>
where
T: ArrowPrimitiveType,
for<'m, 'v> Variant<'m, 'v>: VariantAsPrimitive<T>,
```
This is a code smell.
# What changes are included in this PR?
"Reverse" the trait -- instead of extending `Variant`, the trait extends
`T: ArrowPrimitiveType`. The resulting type bounds are much more
intuitive:
```rust
impl<'a, T: PrimitiveFromVariant> VariantToPrimitiveArrowRowBuilder<'a, T>
```
# Are these changes tested?
Existing unit tests cover this refactor.
# Are there any user-facing changes?
No.
0 commit comments