Trait hooks::Hook

source ·
pub trait Hook: Send + Sync {
    // Required method
    fn on<'life0, 'async_trait>(
        self: Arc<Self>,
        event: &'life0 Event,
    ) -> Pin<Box<dyn Future<Output = Result<(), ModelError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

The component manager calls out to objects that implement the Hook trait on registered component manager events. Hooks block the flow of a task, and can mutate, decorate and replace capabilities. This permits Hook to serve as a point of extensibility for the component manager. IMPORTANT: Hooks must not block on completion of an Action since Hooks are often called while executing an Action. Waiting on an Action in a Hook could cause a deadlock. IMPORTANT: Hooks should avoid causing event dispatch because we do not guarantee serialization between Hooks. Therefore the order a receiver see events in may be unexpected.

Required Methods§

source

fn on<'life0, 'async_trait>( self: Arc<Self>, event: &'life0 Event, ) -> Pin<Box<dyn Future<Output = Result<(), ModelError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§