Skip to main content

ComponentLifecycle

Trait ComponentLifecycle 

Source
pub trait ComponentLifecycle: ComponentLogging {
    // Provided methods
    fn on_start(&mut self) -> Result<Handled, HandlerError>
       where Self: 'static { ... }
    fn on_stop(&mut self) -> Result<Handled, HandlerError>
       where Self: 'static { ... }
    fn on_kill(&mut self) -> Result<Handled, HandlerError>
       where Self: 'static { ... }
}
Expand description

A trait to customise handling of lifecycle events

This trait replaces the pre-v0.9 Provide<ControlPort> requirement.

Provided Methods§

Source

fn on_start(&mut self) -> Result<Handled, HandlerError>
where Self: 'static,

Gets invoked every time a component receives a Start event

The default implementation simply logs something at debug level.

Source

fn on_stop(&mut self) -> Result<Handled, HandlerError>
where Self: 'static,

Gets invoked every time a component receives a Stop event

The default implementation simply logs something at debug level.

Source

fn on_kill(&mut self) -> Result<Handled, HandlerError>
where Self: 'static,

Gets invoked every time a component receives a Kill event

The default implementation simply logs something at debug level.

Implementors§