capnproto-rust
capnproto-rust copied to clipboard
Invoking closure on the event loop to get a mutable reference to self
Capnproto interfaces are translated to traits with methods taking &mut self. So, from my understanding, there's an event loop taking the ownership of self, which receives RPC calls and then executes the correct methods.
Can we add a way to schedule a closure on that event loop, to get access to &mut self?
Something like this:
self.dispatch(|this: &mut Self| async {});
This is somewhat similar to https://github.com/capnproto/capnproto-rust/issues/87, which is about calling RPC methods on self. Off the top of my head, I'm not sure how to make all the types and traits work out, but it does seem like it should be possible.