Open kvark opened 9 years ago
It may look like this: http://dwrensha.github.io/capnproto-rust/2015/05/25/asynchronous-io-with-promises.html
With futures it would be nice if we had an api to make it easy to start tasks when futures are ready.
// return a future
let foo = task(|_| 0u32).start(sched);
// start this task when the task is done
// this creates a barrier on all the futures and enqueues the task
// when the future list is ready
let bar = on_complete!(sched, |sched, foo| {
println!("{}", something);
});
//ect ect ect
let baz = on_complete!(sched, |sched, bar| {});
We could have a
Future
trait for the following things:std::sync::Future
, and our custom futures