ownership
Which variable is responsible for a value and cleaning it up.
Every value has exactly one owner; when the owner goes out of scope the value is dropped.
Loading interactive…
Examples
let city = String::from("Oslo");makescitythe owner of the heap text, which is freed at the closing brace of the blockcitylives in.
See also