Deref

We'll cover the following...

Alright, I’m tired of fruit. Let’s talk about plain old numbers again. Consider this program that only uses mutable variables, no references:

Press + to interact
fn main() {
let x: i32 = 5;
let mut y: i32 = 6;
y -= 1;
assert_eq!(x, y);
println!("Success");
}

What this means is: create a new immutable variable, x, that holds 5. Then create a mutable variable, y ...

Access this course and 1400+ top-rated courses and projects.