pub trait Worker:
Debug
+ Send
+ Restartable {
// Required method
fn init(&self) -> Pin<Box<dyn Future<Output = ()> + Send + 'static>>;
// Provided methods
fn restart_policy(&self) -> RestartPolicy { ... }
fn backoff_policy(&self) -> BackoffPolicy { ... }
}
Expand description
A trait representing a worker that can be restarted.
Required Methods§
Sourcefn init(&self) -> Pin<Box<dyn Future<Output = ()> + Send + 'static>>
fn init(&self) -> Pin<Box<dyn Future<Output = ()> + Send + 'static>>
The initialization entrypoint for the worker. This is called when the worker is started, and can be called an infinite number of times if indefinite restarts are permitted. Therefore, it should be safe to call this repeatedly.
Provided Methods§
Sourcefn restart_policy(&self) -> RestartPolicy
fn restart_policy(&self) -> RestartPolicy
Returns the restart policy for worker.
Sourcefn backoff_policy(&self) -> BackoffPolicy
fn backoff_policy(&self) -> BackoffPolicy
Returns the backoff policy for the worker.