macroquad
macroquad copied to clipboard
Make the ToBytes trait unsafe
Because of the ToBytes impls on arrays and slices, which do not make use of to_bytes of the underlying type, implementing ToBytes makes a promise to unsafe code. This should be explicit, by having the trait itself be unsafe.
Also replaces the impl for &[T] with one for [T], to avoid depending on the layout of &[T]. This is, technically, a breaking change – however, the code that would break didn't actually work at runtime in the first place.
In your opinion, how public should this trait actually be? I looked through the library, and this trait is only used in the set_uniform functions. Maybe it should just be made unavailable for external implementation?