Step 4
TODO: Can variables have owners? And does this page use the right language?
Let's look at what does happen starting with a review of Step 3 where:
- The
alfa
variable has been created - The
String::from("apple")
value has been created and bound toalfa
making the variable its owner - We've made the first half of the expression
to bind
alfa
tobravo
Our illustration looked like this:
Now we can complete the expression with:
let bravo = alfa;
That assignment doesn't make bravo
the
owner of alfa
. Instead the value that's
insdie alfa
gets moved into bravo
and
bravo
becomes the owner.