Skip to content

Learning Rust

Intro:

Rust is a systems programming language that allows for building applications that are performant and efficient during runtime. Rust programs are memory safe and their performance metrics are close to that of C language.

Installation:

  1. Windows: choco install rustc

  2. Linux:curl ...

📌Be sure to check the Rust docs here

Creating a New Project:

cargo new <PROJECT_NAME>

Ownership

Three rules of ownership:

Importance of ownership in Rust

Ownership prrevents memory safety issues:

  1. Dangling pointers

  2. Double-free - trying to free memory that has already been freed

  3. Memory leaks - not freeing memory that should have been freed

Borrowing

Rules of References: