Rust

  • Rust is a multi-paradigm, high-level, general-purpose programming language.
  • Rust emphasizes performance, type safety, and concurrency.
  • Rust enforces memory safety — that is, that all references point to valid memory without requiring the use of a garbage collector or reference counting present in other memory-safe languages.
  • To simultaneously enforce memory safety and prevent concurrent data races, Rust’s “borrow checker” tracks the object lifetime of all references in a program during compilation.
  • Rust is popular for systems programming but also offers high-level features including some functional programming constructs.
  • Designed by: Graydon Hoare

Wikipedia: https://en.wikipedia.org/wiki/Rust_(programming_language)

Prerequisites

Before we begin to install Rust, we need to update our system or make sure up-to-date latest packages

Debian-based system:

sudo apt update && sudo apt upgrade -y

Fedora-based system:

sudo dnf upgrade -y

Install using RustUp Script

Open a terminal and enter the following command:

curl --proto '=https' --tlsv1.3 https://sh.rustup.rs -sSf | sh

The command downloads a script and starts the installation of the rustup tool, which installs the latest stable version of Rust.

Now source the Rust Environment Variable

source "$HOME/.cargo/env"

Verification

To check whether you have Rust installed correctly, open a shell and enter this rust version command:

rustc --version

Updating and Uninstalling

From your shell, run the following command:

rustup update

To uninstall Rust and rustup, run the following uninstall script from your shell:

rustup self uninstall

Hello, World!

fn main() {
    println!("Hello, world!");
}

Official Docs: https://doc.rust-lang.org/book/ch01-02-hello-world.html