You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the arrival of capture devices in SDL2, I've had a look at the current code to see how it works, and we can say for sure that parts of the code aren't really pretty. Adding a capture device will break the API anyway, so maybe we can take advantage of this breaking change to make this API enjoyable to use and safer as well. I've noticed several uses of mem::transmute and mem::replace within the API, and they can almost always be replaced by "safe" code like Box::into_raw. I feel like the API is not Rust-y enough.
For instance, having an AudioCVT in C makes sense, but in Rust we have so many other ways to avoid that.
SDL2_mixer also has its problem with unsoundness and needlessly public struct elements, but we can get on to that later.
The text was updated successfully, but these errors were encountered:
With the arrival of capture devices in SDL2, I've had a look at the current code to see how it works, and we can say for sure that parts of the code aren't really pretty. Adding a capture device will break the API anyway, so maybe we can take advantage of this breaking change to make this API enjoyable to use and safer as well. I've noticed several uses of mem::transmute and mem::replace within the API, and they can almost always be replaced by "safe" code like
Box::into_raw
. I feel like the API is not Rust-y enough.For instance, having an AudioCVT in C makes sense, but in Rust we have so many other ways to avoid that.
SDL2_mixer also has its problem with unsoundness and needlessly public struct elements, but we can get on to that later.
The text was updated successfully, but these errors were encountered: