|
|
|
|
|
by pmarcelll
3070 days ago
|
|
The quoted sentence is not true, but most practical callbacks will create multiple paths to objects via borrows. Or you can move your structs into closures (like in C++). But I think what you originally wrote (using callbacks without Rc/RefCell) is fundamentally hard. You have to guarantee somehow that the struct is still alive when you access it though the borrow in the callback, otherwise you have a memory safety problem. |
|
It is related to closure desugaring.
https://github.com/nikomatsakis/nll-rfc/blob/master/0000-non...