5 ms·
The better a C++ library is, the less possible it will be to create a Rust wrapper for it. Good C++ libraries depend on language features that are, and will alw
by ncmncm 6y ago
The better a C++ library is, the less possible it will be to create a Rust wrapper for it. Good C++ libraries depend on language features that are, and will always remain, wholly inaccessible from Rust.
Almost every feature of C++ is there to make writing powerful libraries possible. Many uses of such features become part of the library interface, because that enables zero-overhead libraries with semantics intricately integrated into the caller's usage.
Rust has a goal of zero-overhead code, but is not designed to minimize the overhead of library usage. That was a choice: it makes the language simpler and easier to learn, but that comes at a cost. You cannot write a Rust library to do what is routinely done in C++ libraries, and a Rust wrapper cannot expose those capabilities to Rust code.