We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
use futures::Future; use tokio::sync::mpsc::channel; fn foo<F, S>(mut f: F) where F: FnMut() -> S, S: Future, { f(); } #[tokio::main] async fn main() { let (tx, mut rx) = channel::<bool>(1); foo(move || async move { let _ = rx.recv().await; }); }
I want to move rx into closure but failed.
I checked a lot of information but still can't solve it.
FnMut
The text was updated successfully, but these errors were encountered:
You expect the closure to be FnMut, but it can't. This is because you can't call it multiple times, since calling it moves rx into an async block.
rx
Sorry, something went wrong.
I did some attempts and it can only be called once. Finally I solved the problem using macros.
No branches or pull requests
I want to move rx into closure but failed.
I checked a lot of information but still can't solve it.
FnMut
closure diagnostic #41790The text was updated successfully, but these errors were encountered: