Runtime agnostic way of waiting for async tasks.
WaitGroup.Add
& WaitGroup.Done
done()
ing the task i.e. calling done()
on drop.add
, done
and RAII semantics.```rust use taskwait::TaskGroup;
let tg = TaskGroup::(); for _ in 0..10 { tg.add(1); let tgc = tg.clone(); tokio::spawn(async move{ ... tgc.done(); }) } tg.wait().await; ```
```rust use taskwait::TaskGroup;
let tg = TaskGroup::(); for _ in 0..10 { let work = tg.add_work(1); // Increment counter tokio::spawn(async move{ let _work = work; // done() will be called when this is dropped ... }) } tg.wait().await; ```