According to the 2020 Stack Overflow inventor Survey, Rust is used by roughly 5% of clients and is the most preferred programming language, with 86% of Rust clients (among the users) willing to continue programming in Rust. There can be a bit of been bias here because Rust is a new language with a small inventor base, so the developers who use it are very likely to be curious – programming in Rust in their leisure time instead of a professional context. They could also work on reasonably new code – without the whole technical debt accumulated by older code that could induce further frustration in general.
But an intriguing insight is that Rust has held this “most preferred” language title for numerous years in Stack Overflow’s survey. And the satisfaction has moved from 83% to 86% in a year, while the inventor base grew from 3% to 5% of respondents. So it’s entirely possible that the improvements of Rust – in particular, the async/await feature – have brought in more satisfaction!
A truly cross-site language
The first aspect that enables Rust a programming language of choice for many use cases is that it works on numerous sites. The list of supported locations is just massive!
An essential part of keeping in mind is that Rust is a set of compiled languages; the compiler has to output a different binary for each site. The produced binaries even have to take the target CPU and the present libraries in the target OS. And we still find it unique that all of these sites are supported by a single compiler.
Given this long list of sites, we will categorize them in a (non-exhaustive!) list to summarize the use cases.
The three popularly known systems for desktops (including laptops and servers) are in type 1 of supported sites. If you possess Windows, Linux, or OSX system released in the recent ten years, Rust is “sure to work” on it with exhaustive automated testing.
Aside from these fully supported systems, you will find more systems present in tier 2 and tier 3. For illustration, you can also write Rust programs for Windows XP (tier 3). Beyond these tiers, someone even managed to compute a Rust program for Windows 98.
Although the Rust compiler does not ship on mobile, you can cross-compile Rust code in iOS and Android applications. The integration model is suitable for developing a native library written in Rust than in C/C++ and invoking it from the primary Android/iOS application.
· You can get started with this tutorial on Android and use the JNI crate to relate with Java from Rust code.
· There is a similar tutorial on iOS (note that it hasn’t been tested).
Web front-end with Web Assembly
On the contrary, the software spectrum is embedded systems. They constitute the lowest software platform related to hardware components, including operating system kernels, firmware, or boot loaders. There are various resources to get started with Rust in embedded systems.
· The Rust embedded working group coordinates several efforts.
· Real-Time For the vast (documentation), develop a simple “bare metal” app on an embedded system.
· Tock (source code), and embedded management system which enables to run of various mutually unreliable applications.
An intriguing part of Rust is that even if a rich standard library is present in the language, it is still not supported by all target sites, and specifically not on embedded sites. Nevertheless, one can compute Rust code in no stud mode, where only a few similar libraries are available. With no std, you can easily do some “basic” operations like performing arithmetic, manipulating memory, and controlling flow. You can also use particular CPU instructions inline assembly. The “basic” operations are usually enough to start programming on an embedded system! However, no std means that you do not get access to managements that need a supporting OS, like reading/writing files or even printing to the terminal output, for there is no supporting OS at the “bare metal” level of software.
However, the no std mode enables Rust to be used on embedded systems. It is compared to languages like Python or Java, for which you need to ship a virtual machine and runtime on a site before you can manage programs on it. For illustration, concepts like Java. Os file does not exist with no supporting OS to offer a file system.