You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 3, 2020. It is now read-only.
I'm a new-comer to rust, particularly to futures and async/await; however, I'm pretty familiar with coroutines and some of the javascript libraries like async-parallel.
I'm aiming to call 2 (or N) long-running async functions, and wait for them both to finish before continuing.
I did a fair bit of googling, and couldn't find any examples in rust of something along these lines in rust.
Here's how one might do it in javascript...
async.parallel({one: function(callback){callback(null,'done1\n');},two: function(callback){callback(null,'done2\n');}},function(err,results){// now we can continue});
Or in golang...
messages:=make(chanint)
gofunc() {
time.Sleep(time.Second*3)
messages<-1done<-true
}()
gofunc() {
time.Sleep(time.Second*2)
messages<-2done<-true
}()
fori:=0; i<2; i++ {
<-done
}
// now we can continue
Any chance we could add an example of this to the documentation?
I'm a new-comer to rust, particularly to futures and async/await; however, I'm pretty familiar with coroutines and some of the javascript libraries like async-parallel.
I'm aiming to call 2 (or N) long-running async functions, and wait for them both to finish before continuing.
I did a fair bit of googling, and couldn't find any examples in rust of something along these lines in rust.
Here's how one might do it in javascript...
Or in golang...
Any chance we could add an example of this to the documentation?