summaryrefslogtreecommitdiff
path: root/Cloning a box does a deep copy of the heap data.md
blob: 25c861dd6dc4a8d33af691146d9df5c31cc9bc9d (plain)
1
2
3
4
5
6
7
[[Rust]]
[[Ownership]]
[[Moved heap data principle]]

---

To get around the issue of not being able to use a box after we moved ownership we can call .clone() on it. A clone is a deep copy of the heap data rather than just a shallow copy of the pointer to the original heap data.