X-Git-Url: https://git.ralfj.de/rust-101.git/blobdiff_plain/4bd3f6148195f83d13a11f3923bd61f59d6bf285..4f92e4d16fbdd96084a09567fc5f8e421c8b2351:/src/part12.rs?ds=sidebyside diff --git a/src/part12.rs b/src/part12.rs index 6803aca..276ccaf 100644 --- a/src/part12.rs +++ b/src/part12.rs @@ -11,9 +11,8 @@ use std::cell::{Cell, RefCell}; //@ This restriction propagates up to `Callbacks` itself. What could we do about this? //@ ## `Rc` - //@ The solution is to find some way of cloning `Callbacks` without cloning the environments. This -//@ can be achieved with `Rc`, a *reference-counted* pointer. This is is another example of a +//@ can be achieved with `Rc`, a *reference-counted* pointer. This is another example of a //@ smart pointer. You can `clone` an `Rc` as often as you want, that doesn't affect the data it //@ contains. It only creates more references to the same data. Once all the references are gone, //@ the data is deleted. @@ -143,7 +142,6 @@ impl CallbacksMut { // `borrow_mut`. //@ At run-time, the cell will keep track of the number of outstanding shared and //@ mutable references, and panic if the rules are violated.
- //@ For this check to be performed, `closure` is a *guard*: Rather than a normal //@ reference, `borrow_mut` returns a smart pointer ([`RefMut`](https://doc.rust- //@ lang.org/stable/std/cell/struct.RefMut.html), in this case) that waits until is