
#Is rust cross platform code
This leaves us with platform specific libraries that we can include in applications that call through the FFI directly into the Rust code at the core of it all. Back to uniffi-bindgen again to then scaffold the language bindings side of things, either Kotlin, Swift, or Python at the moment, with JS and C++ coming soon. Then, using the uniffi-bindgen tool, we can scaffold the Rust side of the FFI and build our Rust code as we normally would, producing a shared library. The interface is defined in a separate file through an Interface Description Language (IDL), specifically, a variant of WebIDL. So how does uniffi work? The magic of uniffi works through generating a cdylib crate from the Rust code. With uniffi we can write the code once in Rust, and then generate the code we need to be able to reuse these components in whatever language (currently supporting Kotlin, Swift and Python with C++ and JS coming soon) and on whatever platform we need. Instead, uniffi does most of the work for us by generating the plumbing necessary to transport data across the FFI, including the specific language bindings, making it a little easier to write things once and a lot easier to maintain multiple supported languages. On top of that, you also end up creating a hand-written wrapper in each and every language that is supported. What exactly does that mean? Typically you would have to write something in Rust and create a hand-written Foreign Function Interface (FFI) layer also in Rust.
#Is rust cross platform generator
So what is uniffi? It’s a multi-language bindings generator for Rust. Unlike Glean, Nimbus was able to take advantage of some tooling that wasn’t available when we started Glean, namely: uniffi. Also like Glean, this presented us with all of the challenges that you would normally encounter when creating a cross-platform library. Like Glean, Nimbus is a cross-platform client SDK intended to be used on Android, iOS, and all flavors of Desktop OS that we support. The idea is to find out what our users like and use so that we can focus our efforts on the features that matter to them.

Nimbus is our new take on a rapid experimentation platform, or a way to try out new features in our applications for subsets of the population of users in a way in which we can measure the impact. In this case, it has been my work on the Nimbus SDK that has inspired this story. On this particular adventure, I find myself once again working on one of these components that tie into the Glean ecosystem. You can find an index of all TWiG posts online.)Īs the Glean SDK continues to expand its features and functionality, it has also continued to expand the number and types of consumers within the Mozilla ecosystem that rely on it for collection and transport of important metrics. They could be release notes, documentation, hopes, dreams, or whatever: so long as it is inspired by Glean.
#Is rust cross platform series
(“This Week in Glean” is a series of blog posts that the Glean Team at Mozilla is using to try to communicate better about our work.
