Trait Worker

Source
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§

Source

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§

Source

fn restart_policy(&self) -> RestartPolicy

Returns the restart policy for worker.

Source

fn backoff_policy(&self) -> BackoffPolicy

Returns the backoff policy for the worker.

Implementors§