Skip to main content

Observer

Trait Observer 

Source
pub trait Observer: Send + Sync {
    // Provided methods
    fn on_executor_up(&self) { ... }
    fn on_executor_down(&self) { ... }
    fn on_executor_error(&self, _e: &ExecutorError) { ... }
    fn on_app_start(&self, _task: TaskId, _app: u32, _instance: Option<u32>) { ... }
    fn on_app_stop(&self, _task: TaskId) { ... }
    fn on_app_error(&self, _task: TaskId, _e: &(dyn Error + 'static)) { ... }
    fn on_send_event(&self, _task: TaskId, _ev: UserEvent) { ... }
}
Expand description

Lifecycle observer invoked by the executor at well-defined points.

All methods have no-op defaults. The executor never blocks on observer callbacks — heavy work should be queued internally.

Provided Methods§

Source

fn on_executor_up(&self)

Called once just before the dispatch loop begins.

Source

fn on_executor_down(&self)

Called once just after the dispatch loop finishes cleanly.

Source

fn on_executor_error(&self, _e: &ExecutorError)

Called when the dispatch loop returns an error.

Source

fn on_app_start(&self, _task: TaskId, _app: u32, _instance: Option<u32>)

Called before an item with app_id().is_some() runs (per invocation).

Source

fn on_app_stop(&self, _task: TaskId)

Called after such an item runs.

Source

fn on_app_error(&self, _task: TaskId, _e: &(dyn Error + 'static))

Called when an item returns Err or panics.

Source

fn on_send_event(&self, _task: TaskId, _ev: UserEvent)

Called when an item invokes Context::send_event.

Implementors§