Skip to main content

handlers

Attribute Macro handlers 

Source
#[handlers]
Expand description

Applied to an impl block to scan for handler methods and generate trait impls.

Methods tagged with #[malbox::on_task], #[malbox::on_start], #[malbox::on_stop], #[malbox::health_check] are wired to the corresponding internal handler traits. Missing handlers get default no-op implementations.

§Example

#[malbox::handlers]
impl MyPlugin {
    #[malbox::on_start]
    fn init(&self) -> Result<()> { Ok(()) }

    #[malbox::on_task]
    fn process(&self, task: Task, ctx: &Context) -> Result<()> {
        Ok(())
    }
}