X-Git-Url: https://git.ralfj.de/rust-101.git/blobdiff_plain/188b1ec1b8528e2326791feccc8077e15bd60182..ebb00d95c585dd0520e54ec48df80262f02583cf:/src/part11.rs diff --git a/src/part11.rs b/src/part11.rs index 5cc1462..211cda5 100644 --- a/src/part11.rs +++ b/src/part11.rs @@ -42,7 +42,7 @@ impl Callbacks { // Registration simply stores the callback. pub fn register(&mut self, callback: Box) { - self.callbacks.push(callback); /*@*/ + self.callbacks.push(callback); } // We can also write a generic version of `register`, such that it will be instantiated with some concrete closure type `F` @@ -102,7 +102,7 @@ pub fn main() { //@ a *pointer* to such a type (be it a `Box` or a borrow) will need to complete this information. We say that pointers to //@ trait objects are *fat*. They store not only the address of the object, but (in the case of trait objects) also a *vtable*: A //@ table of function pointers, determining the code that's run when a trait method is called. There are some restrictions for traits to be usable -//@ as trait objects. This is called *object safety* and described in [the documentation](http://doc.rust-lang.org/stable/book/trait-objects.html) and [the reference](http://doc.rust-lang.org/reference.html#trait-objects). +//@ as trait objects. This is called *object safety* and described in [the documentation](https://doc.rust-lang.org/stable/book/trait-objects.html) and [the reference](https://doc.rust-lang.org/reference.html#trait-objects). //@ In case of the `FnMut` trait, there's only a single action to be performed: Calling the closure. You can thus think of a pointer to `FnMut` as //@ a pointer to the code, and a pointer to the environment. This is how Rust recovers the typical encoding of closures as a special case of a more //@ general concept.