//@ (There's not even an automatic derivation happening for the cases where it would be possible.)
//@ This restriction propagates up to `Callbacks` itself. What could we do about this?
//@ (There's not even an automatic derivation happening for the cases where it would be possible.)
//@ This restriction propagates up to `Callbacks` itself. What could we do about this?
//@ The solution is to find some way of cloning `Callbacks` without cloning the environments. This can be achieved with
//@ `Rc<T>`, a *reference-counted* pointer. This is 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
//@ The solution is to find some way of cloning `Callbacks` without cloning the environments. This can be achieved with
//@ `Rc<T>`, a *reference-counted* pointer. This is 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
pub fn call(&self, val: i32) {
// We only need a shared iterator here. Since `Rc` is a smart pointer, we can directly call the callback.
for callback in self.callbacks.iter() {
pub fn call(&self, val: i32) {
// We only need a shared iterator here. Since `Rc` is a smart pointer, we can directly call the callback.
for callback in self.callbacks.iter() {