pub enum Mode {
Terminate,
Pause,
OnDemand,
}Expand description
Lifecycle policy for a managed task: what the task does on shutdown and what the supervisor does to bring it back.
Variants§
Terminate
Task exits its loop on shutdown. The supervisor respawns it via the
node’s spawn fn from respawn_terminate.
Pause
Task acks shutdown and parks on wait_resume(). The supervisor resumes
it from resume_pausable; the task is never respawned, so it keeps any
resource it holds (a peripheral handle, a socket) across the pause.
OnDemand
Like Terminate (exits on shutdown), but not started at boot and
not auto-respawned. The supervisor brings it up and down at runtime
via start_node / stop_node in response to load — see ElasticPool.
start() skips it; respawn_terminate() leaves it down (it
re-grows under demand); teardown() only acts on it while it is running.