pub trait Supervisable: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn initialize<'life0, 'async_trait>(
&'life0 self,
process_shutdown: ShutdownHandle,
) -> Pin<Box<dyn Future<Output = Result<SupervisorFuture, InitializationError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided method
fn shutdown_strategy(&self) -> ShutdownStrategy { ... }
}Expand description
A supervisable process.
Required Methods§
Sourcefn initialize<'life0, 'async_trait>(
&'life0 self,
process_shutdown: ShutdownHandle,
) -> Pin<Box<dyn Future<Output = Result<SupervisorFuture, InitializationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn initialize<'life0, 'async_trait>(
&'life0 self,
process_shutdown: ShutdownHandle,
) -> Pin<Box<dyn Future<Output = Result<SupervisorFuture, InitializationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Initializes the process asynchronously.
During initialization, any resources or configuration for the process can be created asynchronously, and the
same runtime that’s used for running the process is used for initialization. The resulting future is expected to
complete as soon as reasonably possible after shutdown resolves.
Important: The process_shutdown signal must be moved into the returned SupervisorFuture so the worker
can respond to supervisor-initiated shutdown. If process_shutdown is dropped during initialization, the worker
will be unable to shut down gracefully and will be forcefully aborted after the shutdown timeout.
§Errors
If the process can’t be initialized, an error is returned.
Provided Methods§
Sourcefn shutdown_strategy(&self) -> ShutdownStrategy
fn shutdown_strategy(&self) -> ShutdownStrategy
Returns the shutdown strategy for the process.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".