Skip to content

Instantly share code, notes, and snippets.

View tgodfrey0's full-sized avatar

Toby Godfrey tgodfrey0

  • University of Southampton
View GitHub Profile

Rust Cheat Sheet

Variables & Mutability

Variables are immutable by default. This makes Rust safer and makes concurrency easier.
Immutable means once a value is bound to that variable, it cannot be changed.
For example:

fn main() {
 let x = 5;