Rust! The most beloved programming language for several years

  • This article uses simplifications

Introduction

Rust has grown in popularity in recent years and quickly entered the list of “most loved languages” according to StackOverflow: [Stack Overflow Developer Survey 2021] and remains there to this day.

But what is it and where does its popularity come from?

Cargo and Clippy

Cargo is a package manager (e.g., in js). It does not allow compilation if the program may be unsafe (without declaring the unsafe clause.

  • Thanks to cargo, it’s easy to add (all packages are available on the crates.io website by only pasting the line from the page), remove packages, configure the environment, build, etc. It is a tool with very extensive applications.
  • Clippy is a letter in rust that simplifies the work a lot by telling “what we’re doing wrong” and often “how to fix it.” And if necessary, it will send us to the appropriate page where the error is discussed in more detail. Clippy is installed as a part of cargo by default

Borrowing and Ownership

In almost all articles describing this language, there are two key words, namely borrowing and ownership. However, it is nothing new in the world of programming languages; many languages have something to program in this way, for example in C ++, if we give the auction parameters twice the & sign at the beginning, it will work the same. Rust approached it completely differently because borrowing is the default behavior and we need to use special functions to change this behavior (this applies to types that are not primitives) because primitives are copied by default. This is the mechanism that distinguishes rust most from other dominant programming languages.

Performance and Security

Rust diagram

Thanks to its mechanism, Rust is completely (with the possible exception of some functions) safe until we use the unsafe clause. In many tests, the performance is at the level of more or less C ++ at the same time as opposed to C ++ being safe.

Rust statstics

Low level language high level functions

Rust is called a low-level language because it provides access to memory from it, and gives the possibility to use it at any time if we want indicators not only intelligent but also raw. Just use the unsafe clause. However, Rust has many high-level features immediately available in the language (if we extend the ones that are created by the community, we can write “almost like in high-level languages” [of course, this is a big simplification]) so that writing code is much more efficient than in other, low-level languages.

Disadvantages

High entry threshold

Rust is a specific language due to borrowing, ownership, or lifetime mechanics. It is a language that I would not recommend as the first programming language. Despite the excellent documentation, these concepts are not easy to understand and apply.

Libraries

The language itself is still young (2009), so there is not a very extensive community yet, which often means less popular libraries are not fully described or not described at all, and a lot of abandoned useful projects. (with the increase in popularity, the situation improved significantly, but such cases still occur).

Very long compilation and repetitive packages

Cargo downloads all its dependencies with each package downloaded, which causes frequent duplication of packages or their appearance in different versions. (we can avoid this by setting LTO [link time optimizations] to true in the configuration file, but it can significantly extend an already long compilation)

Supported by large companies

Rust is supported and praised by companies such as Amazon, Dropbox, npmjs, yelp, Sentry, Mozilla, Cloudflare, Microsoft, Buoyant, Sensirion, Airborne Engineering, Terminal Technologies, and many more. The language is mainly praised for its ease of writing with a stable multithreaded code while still being superb performance and the overall performance of the language.

Summary

Rust has problems with a high entry threshold, young libraries, a small community, and a long compilation; however, it did not prevent it from gaining the sympathy of programmers, the most prominent companies, and Linus Torvald, thanks to its undoubted advantage that they combine the most significant benefits of high-level and low-level languages.

I am still in love ❤️ I hope you will like it too and I invite you to learn because it’s worth it.