-
Notifications
You must be signed in to change notification settings - Fork 478
Description
I'm working on patching up after the recent changes from RFC 494.
The String changes are easy enough to fix: but CVec has been removed in its entirety.
The problem with CVec is that we use it quite extensively in the public API.
Should we just write a replacement for CVec that lives in rust-sdl2
? (Maybe call it SDLVec
or something?) The original implementation from the Rust stdlib is <200 lines of code including tests.
We could even take this as an opportunity to eliminate some duplicate code and allocations.
Most of our CVecs with destructors have the exact same destructor. (Call libc::free on the memory in question.) -- Yet every CVec w/ a dtor allocates an FnOnce
to accomplish this.
For our use-case does the dtor really need to invoke a closure? Either we call libc::free
or we don't -- so we could simplify it to a boolean flag and avoid all the closure machinery there.