mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-06-05 17:17:30 +02:00
Copy, clone speaker notes: phrase as sentences i/o questions
This commit is contained in:
parent
e29c3bfb99
commit
65837087c9
@ -40,8 +40,8 @@ Copying and cloning are not the same thing:
|
|||||||
|
|
||||||
In the above example, try the following:
|
In the above example, try the following:
|
||||||
|
|
||||||
* What happens when you add a `String` field to `struct Point`?
|
* Add a `String` field to `struct Point`. It will not compile because `String` is not a `Copy` type.
|
||||||
* Does it work when you remove `Copy` from the `derive` attribute?
|
* Remove `Copy` from the `derive` attribute. The compiler error is now in the `println!` for `p1`.
|
||||||
* After removing `Copy`, can you still print `p1` after the move?
|
* Show that it works if you then clone `p1`.
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user