How can I store an async function in a struct and call it from a struct instance?
问题 I'm trying to achieve this with the new async / await syntax, std::future::Future s and a recent version of Tokio. I'm using Tokio 0.2.0-alpha.4 and Rust 1.39.0-nightly . Different things I've tried include: using Box<dyn> s for the types that I want to store in the struct using generics in the struct definition I couldn't quite get a minimal working version, so here's a simplified version of what I'm trying to achieve: async fn foo(x: u8) -> u8 { 2 * x } // type StorableAsyncFn = Fn(u8) ->