Trait LifecycleListener

Source
pub trait LifecycleListener: Send + Sync {
    // Required method
    fn on_lifecycle_event(&self, event: &ContainerLifecycleEvent<'_>);
}
Expand description

Trait for implementing lifecycle event listeners

Implement this trait to receive notifications about container lifecycle events. Listeners must be thread-safe as they may be called from multiple threads.

§Examples

use verdure_ioc::{LifecycleListener, ContainerLifecycleEvent};

struct MyListener;

impl LifecycleListener for MyListener {
    fn on_lifecycle_event(&self, event: &ContainerLifecycleEvent) {
        println!("Received lifecycle event");
    }
}

Required Methods§

Source

fn on_lifecycle_event(&self, event: &ContainerLifecycleEvent<'_>)

Called when a lifecycle event occurs

§Arguments
  • event - The lifecycle event that occurred

Implementors§