struct DynFn
{
funcs: Vec<std::pin::Pin<Box<dyn std::future::Future<Output=()>>>>
}
impl DynFn
{
fn new() -> DynFn {
DynFn {
funcs: Vec::new()
}
}
}
#[async_std::main]
async fn main() {
println!("Hello, world!");
let mut v=DynFn::new();
v.funcs.push(Box::pin( async { println!("ok1"); } ));
v.funcs.push(Box::pin( async { println!("ok2"); } ));
for item in v.funcs{
item.await
}
}
Created
January 20, 2021 10:21
-
-
Save dollarkillerx/438472a3007faafe82aaadccb3624aac to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment