Rust Programming Language For Beginners Tutorial

Last Updated on

Rust is a memory-safe programming language designed for safe concurrency. It started in 2006 as a personal project of Graydon Hoare before his employer, Mozilla, started sponsoring it in 2009. Mozilla officially introduced it to the world in 2010.

This tutorial is for those who have experience but are new to Rust. We assume the readers have some programming experience in other programming languages and know some basic computer science concepts.

Rust Environment Setup

This tutorial uses Rust 1.42.0.

Windows

There are two ways to install Rust on Windows 10 – through rustup-init.exe  and curl within the Windows Subsystem for Linux. This post uses that .exe  file.

Linux

Work-in-progress.

IDEs for Rust Language

There are 2 IDEs available for Rust – Intellij IDE (using the Rust plugin) and Visual Studio Code.

Rust Language Basics

How To Declare And Use Variables In Rust

Variables in Rust are similar to variables in other high-level programming languages, and how we declare and use them are pretty straight-forward. There are several types of variables, and their declaration may differ from each other.

Data Types

A data type simply refers to the kind of data. A numeric value 1 is a type of data, and a string “1” is another type of data. Rust has a predefined list of core data types that we can build upon to create our custom data types.

Custom Data Types

We can create custom data types in Rust using struct, trait, and enum.

Comments

This is still a work-in-progress.

Control Flow

This is still a work-in-progress.