prologue_hooks

Attribute Macro prologue_hooks 

Source
#[prologue_hooks]
Expand description

Executes multiple specified functions before the main handler function.

This attribute macro configures multiple pre-execution hooks that run before the main function logic. The specified hook functions will be called in the order provided, followed by the main function execution.

ยงUsage

use hyperlane::*;
use hyperlane_macros::*;

#[get]
async fn prologue_handler1(ctx: Context) {
    // First pre-execution logic
}

#[http]
async fn prologue_handler2(ctx: Context) {
    // Second pre-execution logic
}

#[prologue_hooks(prologue_handler1, prologue_handler2)]
async fn main_handler(ctx: Context) {
    // Main function logic (runs after prologue_handler1 and prologue_handler2)
}

The macro accepts a comma-separated list of function names as parameters. All hook functions and the main function must accept a Context parameter. Avoid combining this macro with other macros on the same function to prevent macro expansion conflicts.