Crate awaitdrop

source ·
Expand description

Yet another WaitGroup implementation.

None of the existing crates fit my needs exactly, so here’s one more that (hopefully) will.

Highlights:

  • Generalizes “tasks” to Refs. More of a change in nomenclature than anything else. It’s not always a group of tasks you’re waiting on - it could be that you’re waiting on a gaggle of structs to all be dropped.
  • Refs and Waiters are entirely disjoint. You don’t need a Waiter to create a new Ref.
  • Everything is cloneable and behaves as one would expect - cloned Refs will all block every cloned Waiter, which can be awaited concurrently.

Structs

A reference whose drop can be awaited
The future returned from Waiter::wait
An awaitable handle to some number of references that will eventually be dropped
A reference whose drop can be awaited

Functions

Create a new Ref and Waiter