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).
Notably, Rust has no null value. It instead has Option<T>
and error types.
Language features
Resources
- The Rust Programming Language, by Steve Klabnik and Carol Nichols (also accessible via
rustup doc --book
) - The Rust Performance Book, by Nicholas Nethercote et al.