Crate one_for_one
Source - Supervisor
- Supervisor implements a supervision tree
where all children get terminated on interrupt
but each die on its own when it’s their own trauma.
- current
- Gets a handle on this coode’s Supervisor.
- done
- A future that completes when the supervision
tree is interrupted.
Akin to Go’s
<-ctx.Done()
chan recv. - is_cancelled
- Returns supervision state immediately
- should_die
- Listens to OS signals for ever. Completes on the first one received amon:
- spawn
- Spawn starts a supervised task, calling
spawn
. - spawn_blocking
- Spawn starts a supervised task, calling
spawn_blocking
. - supervized
- Scopes (async) code that needs supervision.
- sync_supervized
- Scopes code that needs supervision.
- terminate
- A future that triggers the interruption or termination
of the supervision tree.
Completes when all children are confirmed dead.