I want to store pointers to async functions in some static list and call them later. How can I do this? E.g.
//async
fn foo() {
}
//async
fn bar() {
}
type MyFn = fn();
const RUNNERS: &[MyFn] = &[
foo,
bar,
];
async fn run() {
RUNNERS[0]()
//RUNNERS[0]().await
}
fn main() {
let _ = run();
}
is a working version for non-async functions.
How have I to implement this so that I can uncomment the async
and await
like in this playground to a non-working version?