arrayfire / arrayfire-rust

Rust wrapper for ArrayFire
BSD 3-Clause "New" or "Revised" License
814 stars 57 forks source link

Remove trait HasEnum from struct definition Array<T> #274

Closed ma2bd closed 3 years ago

ma2bd commented 3 years ago

This is safe because values of a type Array<T> where T is not af::HasEnum cannot be produced by a user anyway.

Pros: this trick allows library users to make their own struct definitions "lightweight" as well (as suggested by the Rust API guidelines).

Cons: the bound has to be removed from the Drop implementation as well (which is fine but perhaps counter intuitive)