Building a simple REST wrapper for iOS, Android, and WASM

First off, thanks to everyone who has contributed in any way to Rust!

I'm looking to create a simple Rust library that is basically a wrapper around a public REST API. This API is and will be used on iOS, Android, and web clients. My goal is for a Rust library to be used on each of these clients, so that any API changes can be mostly made in one codebase.

I understand that it is technically possible to compile Rust code and use it on iOS, Android, and WASM.

However, does this sound like a practically feasible or reasonable goal based on your experience?

Thanks in advance!

I don't know for WASM but on iOS and Android It is certainly possible. The biggest hurdle to me is to map the domain model from Rust to ObjC/Java/JS. On Android for example, you'll need JNI skills to pass objects around and things can get cumbersome quite quickly. You might look for inspiration on how Djinni deals with that.

Mozilla wrote two articles about building a common rust lib and use it on iOS and on android. They are recent and well written.

2 Likes

Thanks for the feedback. This is kind of what I had gathered.