pub struct LifecycleListenerDefinition {
pub name: &'static str,
pub handler: fn(&ContainerLifecycleEvent<'_>),
}Expand description
Static definition of a lifecycle event listener
This structure is used to register event listeners with the container
using the lifecycle_listener! macro. It contains the listener’s name
and handler function.
§Examples
use verdure_ioc::{LifecycleListenerDefinition, ContainerLifecycleEvent};
fn my_handler(event: &ContainerLifecycleEvent) {
println!("Event received");
}
let definition = LifecycleListenerDefinition {
name: "my_listener",
handler: my_handler,
};Fields§
§name: &'static strUnique name identifying this listener
handler: fn(&ContainerLifecycleEvent<'_>)Function to call when events occur
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LifecycleListenerDefinition
impl RefUnwindSafe for LifecycleListenerDefinition
impl Send for LifecycleListenerDefinition
impl Sync for LifecycleListenerDefinition
impl Unpin for LifecycleListenerDefinition
impl UnsafeUnpin for LifecycleListenerDefinition
impl UnwindSafe for LifecycleListenerDefinition
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more