Re:Crates.io incident report for 2020-02-20
by stouset on Monday March 02, 2020 @08:06PM
(#22470861)
Agreed! This is how I've always developed FFI code, for both Rust and Ruby. A thin wrapper that does little more than FFI and maybe mapping onto native memory-management techniques, and then a separate higher-level wrapper that provides as idiomatic an interface on top of the library as possible.
Unfortunately common. That said, I think the best route is usually a thin wrapper module, and then a module that attempts to map that to something more idiomatic. At least then there's a clear place where changes/additions in the underlying library should be handled. I've lived the problem of multiple modules that each try to deal with mapping the underlying library itself to an idiomatic interface. They're good for a while, but they always seem much more susceptible to drift in the underlying library causing problems over time.