pub trait Supervisable: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn initialize(
&self,
process_shutdown: ProcessShutdown,
) -> Option<SupervisorFuture>;
// Provided method
fn shutdown_strategy(&self) -> ShutdownStrategy { ... }
}Expand description
A supervisable process.
Required Methods§
Sourcefn initialize(
&self,
process_shutdown: ProcessShutdown,
) -> Option<SupervisorFuture>
fn initialize( &self, process_shutdown: ProcessShutdown, ) -> Option<SupervisorFuture>
Initialize a Future that represents the execution of the process.
When Some is returned, the process is spawned and managed by the supervisor. When None is returned, the
process is considered to be permanently failed. This can be useful for supervised tasks that are not expected to
ever fail, or cannot support restart, but should still be managed within the same supervision hierarchy as other
processes.
Provided Methods§
Sourcefn shutdown_strategy(&self) -> ShutdownStrategy
fn shutdown_strategy(&self) -> ShutdownStrategy
Defines the shutdown strategy for the process.