The State Of Rust In 2022
We published an article about Rust last year in our edition about Modernism. Here we are back again in this field 15 months later, watching this language take the industry by storm and become an ever-increasing influence in history. This short article will provide an overview of Rust’s most visible impacts, according to this author’s biased eye.
Let us follow an upwards movement in the abstraction ladder for this review, starting at the bottom. On one side, Rust received knighthood status as the second official language of the Linux Kernel. On the other, developers chose Rust to write the Redox operating system from scratch.
On top of such operating systems, we need userland programs. Developers are rewriting many of them in Rust: bat
instead of cat
, exa
instead of ls
, fd
instead of find
and more, sometimes with the same arguments and options, allowing adventurous users to alias
right away. There is not only mere rewriting, though, as quite a bit of innovation is happening, and thankfully so. Pijul and Jujutsu, for example, are not merely Git clones in the source code versioning market but new tools addressing shortcomings and borrowing inspiration from other projects like Fossil.
Programmers need languages to create new software, and Rust is steadily becoming the new C for compiler and runtime (re)construction. Artichoke is Ruby made with Rust. RustPython is Python made with Rust. Deno is TypeScript and JavaScript made with Rust. And there are many more languages built with Rust. There is even a book teaching you how to create your programming language with Rust and scripting languages you can embed inside your Rust apps or games. People are working on the interoperability of Rust with Python and many other programming languages.
We not only want CLI and TUI tools on our Rust-based operating systems but also need GUIs. System76, the maker of Linux laptops, is working in COSMIC, a desktop environment entirely written with Rust and based on gtk-rs. The Tauri project recently reached version 1.0 and positions itself as a solid alternative to Electron for cross-platform GUI applications. But Tauri still requires web technologies on your desktop. What about the 100% native GUI app space? There is still a lot of work, with conflicting approaches and no clear winner yet. Some desktop apps like 1Password run happily with Rust these days.
Full-stack and Cloud Native developers can use Rome to format, lint, and bundle CSS, TypeScript, HTML, and other languages used even higher on the abstraction ladder. They can use Rocket as a replacement for Ruby on Rails or Django or Actix and Hyper for smaller web APIs. They can run WebAssembly in Kubernetes using Krustlet or run their code in Kata Containers much faster since it has been rewritten in Rust. Many benchmarks show that Rust-based web frameworks are among the fastest and most efficient available in the market today. Sadly Firefox fired the Servo team in 2020; we might have had a fully-fledged Rust-based web browser by now.
Not all is green, though. While Rust is eminently great for apps, it is also great for malware, making it faster, smaller, and even harder to detect.
Many companies are using Rust these days: apart from 1Password, mentioned above, there is Dropbox, Google, and many more. Yet, there is still one practical roadblock to the adoption of Rust, which makes Go, C#, Crystal, and Dart worthy opponents at this moment in various scenarios: a steep learning curve. Many programmers are baffled or downright confused by Rust’s borrow checker, and even though Rust produces exceptionally efficient code, companies are skeptical about their developers’ productivity with it. To the point that Google argues that Carbon, its successor to C++, would be a better approach.
Thankfully, learning Rust is becoming easier every day. Developers can learn to read and write Rust code through rustlings. If that is not enough, Amos teaches you Rust in 30 minutes. The Rust Edu organization promotes it in the academic world, and Typst aims to replace LaTeX. Newsletters such as the Rust newsletter, RiB, Rust GameDev WG, and This Week in Rust regularly reflect the innovations in this space directly in your inbox. There used to be another newsletter, RustTimes, but apparently, it is no longer in service. Last but not least, the same week this article hits the web, RustConf 2022 will take place. The Linux Foundation is teaching us how to write kernel modules in Rust.
Only time will tell whether developers will get used to the borrow checker, the same way they got used to garbage collection, runtime exceptions, functional programming, and many other seemingly “alien” concepts in the past 25 years.
In the meantime, we will watch with patience our industry rewrite all the wheels again, falling into the same traps and facing a new uncharted territory. Our craft has not yet reached sufficient maturity to understand that there is no silver bullet. There never was, and never will. As much as Rust seems like an excellent solution for many problems, it is not, and never will be, a replacement for our brains and our capacity to think.
Cover photo by Donald Giannatti on Unsplash.