Skip to main content

worker_with_shutdown

Function worker_with_shutdown 

Source
pub fn worker_with_shutdown<N, F, Fut>(name: N, f: F) -> ChildBuilder<'static>
where N: Into<String>, F: FnOnce(ShutdownHandle) -> Fut + Send + 'static, Fut: Future + Send + 'static, Fut::Output: IntoWorkerResult,
Expand description

Creates a builder for a child task of the current process, with a body that receives the shutdown signal.

The ambient counterpart to SupervisorHandle::worker_with_shutdown.

ยงPanics

ChildBuilder::spawn panics if it is called outside supervision. See spawn.