Ownership

Copy vs Move.

Quick rule

i32 and bool are Copied. Heap string values are Moved — the previous owner becomes invalid.

Move example

After let b = a on an owned string, do not use a.

fn main() {
    let a = "hello"
    let b = a
    print(b)
}

Output

hello