Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invoking closure on the event loop to get a mutable reference to self #450

Open
ranfdev opened this issue Nov 14, 2023 · 1 comment
Open

Comments

@ranfdev
Copy link

ranfdev commented Nov 14, 2023

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 {});
@ranfdev ranfdev changed the title Invoking private method on the event loop to get a mutable reference to self Invoking closure on the event loop to get a mutable reference to self Nov 14, 2023
@dwrensha
Copy link
Member

This is somewhat similar to #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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants