a10 icon indicating copy to clipboard operation
a10 copied to clipboard

Add support for chaining

Open Thomasdezeeuw opened this issue 1 year ago • 1 comments

Not sure what the API would look like, maybe something like the following:

fn chain<Fut1, Fut2, ...>((&mut Fut1, &mut Fut2, &mut Fut2)) -> Chain;

struct Chain<Futs> {
  futures: Futs,
}

impl Future for Chain {
  type Output = ();

  fn poll() {
    // Submit entries to queue for all futures, then return.
  }
}

Usage:

let fut1 = file.write(buf);
let fut2 = file.sync();
chain(&mut fut1, &mut fut2).await;

fut1.await?;
fut2.await?;

Thomasdezeeuw avatar Mar 04 '23 17:03 Thomasdezeeuw