I want more mobile apps to be developed in Rust

85 points kosumi_dev 64 comments

Maybe you are just like me a few months ago: not sure about the feasibility of developing apps in Rust.

Now I can tell you: Rust is the perfect programming language for any apps with some actual complexity.

I am not talking about simple TODO apps. I am talking about apps that consume a lot of computation power and memory.

So far I have developed 2 apps with React Native + Rust. React Native is for UI/UX and platform-specific code, while Rust powers the core logic and state. Both iOS and Android are ARM and we know how good the Rust cross-compilation toolchain is.

The motivation for building both is for my daily use. Both are not toy projects. One of them(a Herdr/SSH client) got 200+ installations on Google Play.

It feels so nice to hold your Rust code in hand, knowing that it is using your phone's battery and memory efficiently. I started without Rust and then gradually mitigated Typescript into the Rust code. Profiling with Perfetto shows a significant decrease in latency and memory usage. The app that used to heat up my phone now feels like a breeze.

The major overhead of the mix of React Native + Rust is FFI crossing. However, if the Rust core contains almost all the states, we can minimize the data movement cost.

Therefore, for the sake of battery, memory and memory safety, please use Rust to build your mobile apps!