Rust is a programming language with broad systems and low-level support. It’s set to broadly replace C++ in systems programming because of its memory-safety.
Basics
Rust follows a strong, static typing system, with support for inferred types. By default, variables are immutable, unless we add the mut specifier. Immutable variables can have their names reused. There are two main types of data types in Rust: scalar types and compound types. The usual integer, float, char types are scalar types. Compound types include: tuples, arrays, and structs.
By convention, Rust uses snake_case for function and variable names.
Code can be divided into two categories: statements (which perform an action and don’t return a value) and expressions (which evaluate and return a result). By default, functions return implicitly (without a return statement).
In Rust, many constructs (
if, loops,match) can return values to an assignment.
Notably, Rust has no null value. It instead has Option<T> and error types.
Language features
- Types
- Mutability (
mut) - struct (
struct) - Option type (
Option<T>) - Error type (
Result<T, Err>)
- Mutability (
- Modularity
- Memory access
- Tools
Resources
- Introductory resources
- The Rust Programming Language, by Steve Klabnik and Carol Nichols (also accessible via
rustup doc --book) - C++ to Rust Phrasebook
- The Rust Programming Language, by Steve Klabnik and Carol Nichols (also accessible via
- The Rust Performance Book, by Nicholas Nethercote et al.
- Rust for Rustaceans, by Jon Gjengset
- Rust Atomics and Locks, by Mara Bos
- Learning Rust with Entirely Too Many Linked Lists
https://blessed.rs/crates https://lib.rs/ https://rust-lang.github.io/async-book/ https://loglog.games/blog/leaving-rust-gamedev/
Development environment
choco install jetbrainstoolbox
choco install rustup.install