Rust Crash Course - Ultimate
let x = 5; let y = x; // copy, both valid
: Start a new project using cargo new my_project . Run it with cargo run . 2. The Foundations: Variables and Types ultimate rust crash course
And here's an example of an enum:
Rust's ownership model is based on three rules: let x = 5; let y = x;
fn change(s: &mut String) s.push_str(" world"); let x = 5
To use the value inside, you must handle both cases (usually with match or unwrap ).
A trait defines shared behavior.