We did a similar thing with a Scala -> Rust rewrite for the <a href="http://prisma.io" rel="nofollow">http://prisma.io</a> query engine.<p>By rewriting small components and integrating them into the existing project using Javas native interface, our small team of 5 developers were able to pull off this massive rewrite in just under a year. The resulting code base is rearchitected in a few very important ways, but mostly follows the same structure.<p>And because we kept and evolved our old Scala based test suite, we have a very high confidence in the rewrite.<p>When Async/.await finally landed, we could switch over very quickly, and it has been a joy to focus on benchmarks and performance over the last month. Spoiler: Rust is faster than Scala :-D
This ability to incrementally add Rust to a C codebase is very useful for adopting Rust in established projects.<p>You don't actually have to rewrite everything on day one. You can stop writing new C code right now, and then gradually replace old code only when you need to fix it or refactor it.
> However, Rust has a killer feature when it comes to this sort of thing. It can call into C code with no overhead (i.e. the runtime doesn’t need to inject automatic marshalling like C#’s P/Invoke) and it can expose functions which can be consumed by C just like any other C function.<p>As we see below, you may still need to write some code to convert from C types to something that is more ergonomic to use in Rust. But the marshaling ABI-wise is minimal.<p>> Turns out the original tinyvm will crash for some reason when you have multiple layers of includes<p>It's actually crashing because there are no lines of code in the file, so certain data structures never get initialized.
> This is where build scripts come in. Our strategy will be for the Rust crate to use a build.rs build script and the cc crate to invoke the equivalent commands to our make invocation<p>Yikes - port the entire build system to cargo before you write a line of Rust. Now draw the reset of the owl!<p>Surely's there's an incremental path for the build as well? Perhaps if you're using CMake?