Implement packed arrays non-generically by ttencate · Pull Request #91 · godot-rust/gdext (original) (raw)

The ideal is to have a struct PackedArray<T>, where T implements some PackedArrayElement trait. But since the autogenerated InnerPacked*Array types are entirely independent at the moment and don't implement a common trait, that would require indirecting every method implementation through PackedArrayElement, which results in mentioning each method call three times: once in impl PackedArray<T>, once in PackedArrayElement and once in impl PackedArrayElement for T.

So, for now, we use a big (but quite straightforward) macro to define each Packed*Array as a separate type.