Implement num/bool_mask/angle traits for `Wide*` types of the `simba` crate
First, thanks for this amazing crate :)
TLDR
error[E0277]: the trait bound `simba::WideF32x8: palette::num::Real` is not satisfied
This issue proposes adding implementations of palette’s num, bool_mask, and angle traits for simba's Wide* wrapper types (e.g., WideF32x4). This change — enabled behind a feature flag — would let palette work seamlessly with both SIMD and scalar data, allowing developers to write generic color manipulation code without extra wrappers, thus overcoming current orphan rule limitations.
Motivation
Palette allows color manipulation, management and conversion pretty much independent on how the color is stored. That also means we can use SIMD (SoA) or non-SIMD types for almost everything in palette.
So it's the perfect crate to use if one needs to write code to work with color that should be generic over SIMD/non-SIMD color data (e.g. you want to compile a binary for targets that do support SIMD and for targets that don't support SIMD, or you want to use palette in code paths that handle SIMD SoA data, and in other paths that work with plain scalars.
The wide crate, which palette already implements most of it's num/bool_mask/angle traits for, is a great way to write portable SIMD code. However, it does not provide any way to be generic over how many SIMD-lanes you'd like to use, and you will need to write different code on whether the code works with wide types or with plain scalars.
That's where the crate simba comes in. It defines traits that are implemented for scalar types as well as SIMD types, and it also supports the types from the wide crate.
However, in order to comply with the orphan rules for traits, the simba crate had to create wrapper types around the wide types, so e.g. WideF32x4 for f32x4 and implement their trait on the Wrapper types.
This unfortunately means that these wrapper types are no longer usable with palette, because they don't implement palette's num/bool_mask/angle traits:
error[E0277]: the trait bound `simba::WideF32x8: palette::num::Real` is not satisfied
Desired change
If palette could implement their num/bool_mask/angle traits (behind a feature flag) for the simba WideF32* wrapper types, it would enable writing such SIMD/non-SIMD generic code much easier and palette usable in such scenarios.
Due again to the orphan rules, the only crates that could implement palette's traits for the simba WideF32* wrapper types are palette and simba. Users of those crates are not able to implement these traits for the wrapper types without wrapping the WideF32* types again in another wrapper type. But the user's have to implement the palette traits as well as the simba traits for their wrapper type.
So I propose to implement the num/bool_mask/angle traits for simba's WideF32* wrapper types behind a feature flag.