Write React Native "Turbo Module" in Rust

939 views Asked by At

React Native recently introduced experimental support for Turbo Modules, which allow developers to write code in C++ and call it directly from Javascript.

Is it possible to write a Turbo Module in Rust instead of C++? Generally Rust has good interoperability with C / C++ so I expect it is possible, but I couldn't find any examples of it after searching Google, StackOverflow, GitHub, etc.

If it is possible, are there any downsides to doing so? Do you losing typing information for instance?

1

There are 1 answers

0
Kirill Novikov On

You can use bridge between C++ and Rust https://cxx.rs/ Follow this thread to get an example of Rust integration https://twitter.com/_va_run/status/1493699146552803329