Rust by the Numbers: The Rust Programming Language in 2021
Programming languages come and go; while some create hype, some just vanish away. We all know it is tough to penetrate the developers’ core area and influence them, and when it comes to programming languages, they are very picky. Well, Rust as a programming language is doing everything it can to win the hearts of developers.
Rust has been Stack Overflow’s most loved language for four consecutive years in a row, and this indicates that whoever has had the opportunity to work with this language fell in love and liked it immediately.
Plus, with popular DevOps tools like JFrog Artifactory now adding support for Rust out of the box, it’s exciting to see Rust enter the mainstream for many development shops. With this, let’s take a look at why it’s gotten so popular.
Introduction to Rust
Introduced in 2010, Rust was created at Mozilla Research as a more reliable, safer alternative to C++. Rust is a static multiparadigm, memory-efficient programming language, focused on speed, security, and performance. It is used to develop game engines, file systems, websites and tools, operating systems, browser components, and much more. Rust Foundation, an independent organization, now manages the open source code base.
Rust supports imperative as well as functional programming, and it is also full-featured enough for application development — it is used by some of the big giants like DropBox, Coursera, and Firefox, etc. Rust also received a lot of attention on HackerNews. Over the last year, many big companies like Microsoft, Facebook, and Intel, joined hands to support Rust.
To prove why Rust is phenomenal, let’s talk about some features that make Rust shine,
- Rust has excellent documentation.
- Rust has a highly user-friendly compiler, including top-notch tools such as integrated package managers and multi-editor.
- Rust tooling has high-level traits such as type inspection and auto-completion.
- Rust is super fast, it prevents crashes, and it is safe by default.
- Rust resolves obstacles that C and C++ have been struggling with for a very long time, and these include memory errors and building concurrent programs.
Companies like Microsoft are using Rust for the safety of their products. Microsoft is encouraging their developers to rewrite some of their components in Rust because they discovered that most of the security patches are fixes to memory-related bugs, and Rust would’ve been able to catch these bugs during the development phase.
Microsoft believes that Rust can help make software bugs, particularly those leading to security vulnerabilities, impossible.
What Makes Rust Different?
Unlike other programming languages, Rust was built from scratch, and it incorporates elements and findings from high-level systems programming languages and modern programming language design.
Also, as an open source project, Rust has developers who have optimized and smoothed out the user experience. For example, the compiler generates very accurate and particularly instructive error messages to help the users; it even highlights offending code and also recommends how to fix it.
The Rust community also provides thorough documentation and immediate online help. Not just the tooling but infrastructure around Rust is commendable. Unlike many other programming languages, where you need to use many compilers, Rust can be used with ease by having a single tool, named Cargo, to compile the code, run tests, generate documentation, and upload a package to a repository and much more.
Rust has a powerful command-line interface tool; it’s an excellent tool for developing web applications and also cross-platform applications. Rust is profoundly suitable for low-resource environments. For popular development environments, there are Rust plugins, such as Visual Studio Code by Microsoft, IntelliJ by JetBrains, and Rust Playground, and it provides a rich live online environment of Rust for code experimentation.
Some Shining Rust Stats
When it comes to popularity, Rust is on top. Since 2015, Rust has been voted the most loved programming language by developers on Stack Overflow’s developer survey for four consecutive years (2016, 2017, 2018, 2019):
Rust is at the top of the top 10 programming languages to earn the highest salaries for 2020:
- On Google trends, you can see the way Rust’s search results are growing year by year:
According to the survey by Stack Overflow, Rust is on the top five list of most wanted top programming languages:
Rust broke into TIOBE’s index of the top 20 most popular programming languages for the first time in 2020. And in the 2020’s Sub-Reddit survey (r/adventofcode), Rust was positioned as the second most used programming language after Python.
Let’s Talk about Cargo, the Captain
Besides being a great and most loved programming language, Rust additionally features a build system and a package manager named Cargo. Cargo manages many tasks, such as building the code, downloading the libraries the code depends on, and building these libraries. The two, Rust and Cargo, are bundled together; you get Cargo when you install Rust.
The simple and small programs in Rust will not have any dependencies. But as you start writing more complex programs with Rust, there comes a need to add and manage dependencies; this is where Cargo comes in handy. When you start a project by using Cargo, adding and managing dependencies will be much easier things to do. Packages in Rust are often referred to as “crates” in the Rust community.
In simple terms, Rust’s package manager and build system is named “Cargo.” Using Cargo, it is effortless and straightforward to access libraries provided by the community in crates.io.
When using Cargo, it will look up and find the accurate version and download the source, ensuring that any other required crates are downloaded. By following the instructions given on the official website or the Cargo Book, we can easily install both the Rust and the Cargo package manager in one go. For Linux/macOS, this should work:
$ curl https://sh.rustup.rs -sSf | sh
Now we can manage our Rust code by Cargo.
Cargo is recognized as one of the exceptional strengths of the Rust ecosystem. Without Cargo, we would have had to search for libraries, download these libraries from unknown sources from GitHub, build as static library crates, link them against the program. How painful this is all to do. But we have Cargo that does all this for us while working with Rust.
To improve your Rust skills and experiment more, download and read this open-source Cargo Book written by the Rust team.
Real-World Rust Usage and Experiments
Firecracker by Amazon Web Services is written entirely in Rust. It powers Fargate and Amazon Web Services‘ Lambda.
Amazon, Google, Intel, and Red Hat jointly started a project, “rust-vmm,” to share common Rust “crates” or what we call packages with one another and the rest of the Rust community.
Microsoft used Rust over Go for WebAssembly — a project from Azure to test WebAssembly modules in Kubernetes. Apart from this, Microsoft is experimenting with Rust to rewrite low-level components of Windows initially drafted in C and C++.
Companies like Dropbox, npm, Microsoft, Amazon, Discord, Cloudflare, Figma, Coursera, etc use Rust in production.
Rust will probably continue to bloom. As more and more companies choose this unique language, it is also time to think about the security aspects while creating projects with Rust as the programming language. As you look at adopting Rust, you might want to consider managing Cargo repositories alongside your current applications. Be sure your artifact management tool understands Cargo Crates and provides a secure repository. Artifactory natively supports the Cargo registry for the Rust programming language, giving you complete control of your deployment and resolving Cargo packages.