Something like this works:
struct Profile;
use futures::future::{Future, BoxFuture};
type ProfileInfoGetter = fn(&str) -> BoxFuture<'_, Result<Profile, ()>>;
async fn get_steam_profile_info(id: &str) -> Result<Profile, ()> {
Ok(Profile)
}
async fn get_fortnite_profile_info(id: &str) -> Result<Profile, ()> {
Ok(Profile)
}
fn main() {
let fetchers: Vec<ProfileInfoGetter> =
vec![
|id| Box::pin(get_steam_profile_info(id)),
|id| Box::pin(get_fortnite_profile_info(id)),
];
}
Note that this may be a somewhat nontrivial task in and by itself in case you want to call the async fn
s in parallel.