How to accept an async function as an argument?
async functions are effectively desugared as returning impl Future. Once you know that, it’s a matter of combining existing Rust techniques to accept a function / closure, resulting in a function with two generic types: use std::future::Future; async fn example<F, Fut>(f: F) where F: FnOnce(i32, i32) -> Fut, Fut: Future<Output = bool>, { f(1, 2).await; … Read more