mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-04-27 17:42:18 +02:00
Ownership speaker notes (#172)
* ownership speaker notes Co-authored-by: Martin Geisler <mgeisler@google.com>
This commit is contained in:
parent
b602dc9be4
commit
13da3112e9
@ -16,3 +16,11 @@ fn main() {
|
|||||||
* When `s1` goes out of scope, nothing happens: it has no ownership.
|
* When `s1` goes out of scope, nothing happens: it has no ownership.
|
||||||
* When `s2` goes out of scope, the string data is freed.
|
* When `s2` goes out of scope, the string data is freed.
|
||||||
* There is always _exactly_ one variable binding which owns a value.
|
* 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>
|
Loading…
x
Reference in New Issue
Block a user