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

Make System::with_tokio_rt take a FnOnce #452

Open
DzenanJupic opened this issue Mar 18, 2022 · 0 comments
Open

Make System::with_tokio_rt take a FnOnce #452

DzenanJupic opened this issue Mar 18, 2022 · 0 comments

Comments

@DzenanJupic
Copy link

System::with_tokio_rt currently takes a Fn, which is quite restricting, since it does not allow moving ownership of captured variables into the closure (at least not in a clean way). This is especially useful if the runtime had to be initialized before the system and was stored in a global variable or passed as an argument.

The code in with_tokio_rt only calls the closure once, and since Fn: FnMut and FnMut: FnOnce, this should not be a breaking change.

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

1 participant