Rust Programming Language

Anushka Choudhary
The Project Team
Published in
5 min readNov 25, 2020

Stack Overflow combined a list of most loved programming languages and for the fifth time in a row, Rust was declared as the most loved programming language. The survey was conducted among 65,000 users and a whopping 86% of its users said that they wish to continue using this language even in the future. This was a far greater percentage compared to popular languages such as Python, Kotlin, TypeScript, etc. So, what is it that makes Rust the most beloved language? Let us find out.

Rust logo

The first question in our quest is that what exactly is Rust and how is it different from other programming languages?

Rust is a static multi-paradigm programming language, more focused on performance and security. In practice, its usage resembles a lot of C++, being very light, simple, and fast. It was created by Graydon Hoare for Mozilla and later refined until it reached a stable version for release. Rust can be used to create game engines, operating systems, file systems, browser components, websites and tools, and more.

Rust is really fast, to the point of almost reaching C++ performance numbers. It plays very well with systems that require intense safety and concurrency by defining strong security barriers, ensuring the system’s protection at its core. This focus on safety can be seen everywhere within Rust, from the syntax to the basic data structure definitions.

How to get started with Rust?

Now that we have a basic idea about Rust, we can dive into getting started with it and learn to write some simple programs in Rust. Before we can begin writing code in Rust, we need to install it on our system and for this the most popular method is rustup.

Here are the steps to complete the installation process on Windows.

1. Visit the link https://www.rust-lang.org/tools/install for starting the process.

2. Choose your desired downloading option from DOWNLOAD RUSTUP-INIT.EXE (32-BIT) and DOWNLOAD RUSTUP-INIT.EXE (64-BIT). Download and install the application.

3. If you’re a Windows Subsystem for Linux user run the following in your terminal, then follow the on-screen instructions to install Rust.

curl — proto ‘=https’ — tlsv1.2 -sSf https://sh.rustup.rs | sh

rustup installation page

After installing, the most basic step is to write a simple Hello World program in any programming language. The purpose of this program since the beginning was to run and test the compiler.

hello world program in rust

For anyone familiar with C++ this code resembles the code very much. Rust also uses the curly braces and semicolon structure just like C++ and a main function as well. The exclamation mark used after println indicates that it is a macro call which takes a format string and some values similar to Python. Another program similar to Python are the looping and if-else statements.

program using for and if-else

An interesting difference to note here in comparison to C++ is that there are no round braces around the if condition but curly braces are used for the condition block for the print statements.

Now that we have looked through some basic programs in Rust, a common doubt would be that what is this programming language used for and who is the one using it?

Developers are using Rust to create a wide range of new software applications, such as game engines, operating systems, file systems, browser components and simulation engines for virtual reality. An active community of volunteer coders maintains the Rust code base and continues to add new enhancements. Mozilla sponsors the Rust open source project.

Rust makes systems programming accessible by combining power with ergonomics. Using it, programmers can make software that is less prone to bugs and security exploits. Under the hood, it includes powerful features such as zero-cost abstractions, safe memory management, fearless concurrency and more.

Currently many companies are using Rust in production all over the world, including Mozilla, Dropbox, npm, Postmates, Braintree and others.

We all have our own preferences when it comes to programming languages, and as it is very clearly visible that Rust is similar to C++ and Python 3, so users and programmers are often wondering which of these languages are better and is it worth it to learn this new programming language Rust?

rust compared to other languages

When compared with C++, the main advantage of using Rust is safety. C++ doesn’t protect its own abstractions, and so, doesn’t allow programmers to protect theirs either. Rust on the other hand, does both. If we make a mistake in C++, the program will technically have no meaning, which can result in arbitrary behaviour. Unlike C++, Rust protects us from such dangers, so we can instead concentrate on solving problems.

Some sources believe that Rust might actually hold a chance to replace C++ someday because Rust is much better in several aspects, like memory safety, concurrency and it lets the user think more carefully about memory usage and pointers. In fact, the transition has already started when AAA game studio switched to using Rust after using C++ for close to 3 decades for game development.

IoT is another booming field, where Rust is finding rapid adoption. Rust seems to be doing pretty well in the GUI department too, with tools like Piston. In fact, we might also find Rust being used along with popular GUI framework, Qt.

Thus, it is safe to say that Rust is becoming more and more popular by the day, though it will certainly take a long time to replace existing languages like C++, there is certainly some chance that the transition will take place someday. Rust is a user-friendly language and provides some unique feature which has made it one of the most loved programming languages.

Source- For a detailed introduction and working of Rust visit the following link: https://stevedonovan.github.io/rust-gentle-intro/1-basics.html

--

--

Anushka Choudhary
The Project Team

CSE undergrad student from India. Passionate in content writing, graphic design, UI design, web and app development.