Rust Library Compatibility Levels

From microcontrollers to full-blown Linux systems, Rust has you covered!

3 minute read

Rust is a general-purpose language, as such it can be used in a variety of environments going from bare-metal microcontrollers(as previously explored here) to Linux systems with many layers of abstractions. As such the libraries developed for it sometimes may or may not work in different environments, depending on what they use.

So let’s go lower in terms of features and abstractions, but higher in terms of compatibility:

Different libraries support different levels of compatibility, and often allow running on no_std via no-default-features, such as serde or serde_json, both of which support no-std with some restrictions.

And it has to be said that no library author is obliged to support any of these levels, but it’s nice if they do, as I found out while playing around with ESP32 microcontrollers. And if you are designing a library, it might be worth considering supporting some of these layers, as it makes your library more versatile and thus more useful, and also mentioning it clearly in the README.

Rust also has a list of targets along with what they support.

And are the levels mentioned in the article in a simple graphic you can download and share(created using the excellent Excalidraw): Rust Library Compatibility Levels

I hope this was informative to you. If you have any questions or suggestions feel free to contact me. And if you want to support me and my work, you can do so here.

Thanks to my sponsors flyaruu for making these posts possible!

< Home