From 295b343aecf330e830d79f06e0efc511e7d76da1 Mon Sep 17 00:00:00 2001 From: Jasper Ras Date: Tue, 5 Aug 2025 08:53:21 +0200 Subject: vault backup: 2025-08-05 08:53:21 --- Cloning a box does a deep copy of the heap data.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Cloning a box does a deep copy of the heap data.md (limited to 'Cloning a box does a deep copy of the heap data.md') diff --git a/Cloning a box does a deep copy of the heap data.md b/Cloning a box does a deep copy of the heap data.md new file mode 100644 index 0000000..25c861d --- /dev/null +++ b/Cloning a box does a deep copy of the heap data.md @@ -0,0 +1,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. \ No newline at end of file -- cgit v1.2.3