Introduction to Rust Programming πŸ¦€

Introduction to Rust Programming πŸ¦€

Start coding in the most popular system programming language, Rust, with this tutorial series for beginners.

The Rust programming language is one of the fastest adopted systems programming languages by developers and tech companies. It is also voted as one of the most loved programming languages by developers who use it on a daily basis. Rust has been getting this love for seven consecutive years now!

It is so popular that there are now two big efforts being carried out in the Linux ecosystem:

And that is just in the Linux ecosystem. Android's Bluetooth implementation Gabeldorsche is now written in Rust.

Do you see the rising popularity of Rust? You would probably like to learn coding in Rust.

Why use Rust?

Rust is a programming language that has an extremely strict type system. As a result, you are "forced" to not write unsafe in the first place. (Unsafe code doesn't mean that it won't leak the memory, though.).

The Rust programming language has the following "goals":

  1. Speed: Rust's binaries are as fast as C binaries, sometimes outpacing C++ binaries!
  2. Memory safety: Rust has a huge emphasis on memory safety.
  3. Concurrency: Focusing on memory safety eliminates a lot of race condition-like scenarios and helps you introduce concurrency in your program.

Following are a few errors mistakes one might make in languages like C/C++ (but not with Rust):

  • Use after free
  • Double free
  • Accessing out-of-bound values
  • Using NULL
  • Inappropriate pointer arithmetic and/or access
  • Use of uninitialized variable(s)
  • Thread-unsafe multi-threading

Have a look at the issues caused by such issues at major corporations like AppleMicrosoftGoogle0day etc,

Now that you know why one might want to choose the Rust programming language over any other one, let's start with the Rust language tutorial series!

Intended audience

For the love of Rust, Pratham created this series of Rust tutorials to help you get acquainted with the concept of Rust programming.

This tutorial series is intended for folks already familiar with programming languages like C and C++. We assume you know basic terms like variablesfunctionsloops, etc.

The only prerequisites is your time and some effort.

1. Create and run your first Rust program

The first chapter of the Rust Basics series discuss the installation of Rust followed by your first ever Rust program. You'll learn to compile and run the Hello World program in this chapter.

Rust Basics Series #1: Hello World Program in Rust
In the first chapter of the Rust programming series, you learn to write and execute your first program in Rust.

2. Use variables and constants

Next, you'll learn about using variables in Rust. Rust's variables are different from other programming languages as they are immutable by default. Learn about them in this chapter.

Rust Basics Series #2: Using Variables and Constants
Move ahead with your Rust learning and familiarize yourself with Rust programs’ variables and constants.

3. Learn scalar data types

Rust has two categories of data types: scalar and compound.

In the third chapter, you'll learn about scalar data types such as integers, floats, characters and booleans.

Rust Basics Series #3: Data Types in Rust
In the third chapter of this series, learn about Integers, Floats, Characters and Boolean data types in Rust programming language.

4. Learn compound data types

The compound data types can store multiple values in a single variable. Rust has two compound data types; arrays and tuples. Know more about them in this chapter.

Rust Basics Series #4: Arrays and Tuples in Rust
In the fourth chapter of the Rust series, learn about compound data types, Arrays and Tuples.

5. Use functions

Like any modern programming language, Rust, too, has functions. In fact, the main function is required to run any Rust program.

Rust Basics Series #5: Functions in Rust
In this chapter of the Rust Basics series, learn to use functions and return values from them with the help of examples.

6. Know about using conditional statements

Add some logic to your Rust program by using conditional statements like if-else.

Rust Basics Series #6: Using If Else
You can control the flow of your program by using conditional statements. Learn to use if-else in Rust.

7. Have fun with loops

Learn about the regular for and while loops along with the special loop loop.

Rust Basics Series #7: Using Loops in Rust
Loops are another way of handling control flow of your programs. Learn about for, while and β€˜loop’ loops in Rust.

8. Test your Rust knowledge with a complex program

You have learned the absolute basics of Rust programming. Now it is time to use them all in this slightly complicated programming exercise.

Rust Basics Series #8: Write the Milestone Rust Program
In the final chapter of the Rust Basics Series, recall the concepts you learned and write a somewhat complex Rust program.

Where to go from here?

It's FOSS will have another Rust series to take you to the intermediate level. But don't wait till then. Explore some Rust projects on GitLab and GitHub. You can always refer to the official Rust documentation and learn more.

The Rust Programming Language - The Rust Programming Language

It's FOSS doesn't cover coding as much as Linux. This is an attempt to cover a programming language that is gaining popularity among application developers. Perhaps you'll use the knowledge to develop Rust applications for Linux one day.

Enjoy learning Rust with It's FOSS πŸ¦€πŸ¦€