Attribute Macro pre_hook

Source
#[pre_hook]
Expand description

Executes a specified function before the main handler function.

This attribute macro configures a pre-execution hook that runs before the main function logic. The specified hook function will be called first, followed by the main function execution.

ยงUsage

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

#[get]
async fn pre_handler(ctx: Context) {
    // Pre-execution logic
}

#[pre_hook(pre_handler)]
async fn main_handler(ctx: Context) {
    // Main function logic (runs after pre_handler)
}

The macro accepts a function name as parameter. Both the hook function and main function must accept a Context parameter. Avoid combining this macro with other macros on the same function to prevent macro expansion conflicts.