Methods sometimes need access to the Arc managing self. This is easy: fn f(self: Arc) (to own the reference count) or fn f(self: &Arc) (to borrow it with the possibility of owning a count later by clone()). The former has the issue that every method call consumes self so many calls need o.clone().f() which is very unergonomically and it's slower because of the forced atomic inc/dec. But the &Arc version works, so whatever. However, if I want to pass around an Arc, then...| The Rust Programming Language Forum
This is not a real problem that I have, but I was thinking on how similar functionality can be implemented in Rust. I have an application struct, which owns other subsystems, such as the Executor. I want to be able to push closures to the executor, which contain references to the application struct. Essentially I want to have my own scoped closures, similar to scoped threads in std. As in the following example. What are the safe ways to implement this? I want the App to specifically not be wr...| The Rust Programming Language Forum