mirror of
https://github.com/google/comprehensive-rust.git
synced 2024-12-15 06:20:32 +02:00
Update drop.md (#246)
Adding speaker notes about more details when people might want to call `drop`. It is not about a `Drop` trait per-se, but if this is to be mentioned in the course, this is a reasonable place. --------- Co-authored-by: Martin Geisler <mgeisler@google.com> Co-authored-by: Martin Geisler <martin@geisler.net>
This commit is contained in:
parent
c5231fc38a
commit
0b8ec0ca3e
@ -31,6 +31,10 @@ fn main() {
|
||||
|
||||
<details>
|
||||
|
||||
* `drop` is called automatically, but it can be called manually like in this example.
|
||||
* If it was called manually, it won't be called at the end of the scope for the second time.
|
||||
* Calling `drop` can be useful for objects that do some work on `drop`: releasing locks, closing files, etc.
|
||||
|
||||
Discussion points:
|
||||
|
||||
* Why doesn't `Drop::drop` take `self`?
|
||||
|
Loading…
Reference in New Issue
Block a user