kornelski / rust-rgb

struct RGB for sharing pixels between crates
https://lib.rs/rgb
MIT License
97 stars 19 forks source link

Associated array length rather than generic. #81

Closed ripytide closed 2 months ago

ripytide commented 2 months ago

This is an important change for the generic use of a pixel type since the N parameter is a leaky abstraction that should be inherent to each particular pixel.

This PR fixes that using another generic associated type for storing the fixed compile-time sized array type.

The drawback is that since we no-longer know the array size in the trait itself we can't provide default implementations, but I don't think that's much of a drawback as they are easy enough to implement on each type, especially with macros in case it gets repetitive like in 0.8.