1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2024-12-12 05:24:12 +02:00

Ownership speaker notes (#172)

* ownership speaker notes

Co-authored-by: Martin Geisler <mgeisler@google.com>
This commit is contained in:
Brandon Pollack 2023-01-17 17:09:14 +09:00 committed by GitHub
parent b602dc9be4
commit 13da3112e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,3 +16,11 @@ fn main() {
* When `s1` goes out of scope, nothing happens: it has no ownership.
* When `s2` goes out of scope, the string data is freed.
* There is always _exactly_ one variable binding which owns a value.
<details>
* Mention that this is the opposite of the defaults in C++, which copies by value unless you use `std::move` (and the move constructor is defined!).
* In Rust, you clones are explicit (by using `clone`).
</details>