# `#[forward]` The `#[hyperactor::forward]` macro connects a user-defined handler trait implementation (like `ShoppingListHandler`) to the core `Handler` trait required by the runtime. In short, it generates the boilerplate needed to route incoming messages of type `T` to your high-level trait implementation. ## What it generates The macro expands to: ```rust #[async_trait] impl Handler for ShoppingListActor { async fn handle(&mut self, ctx: &Context, message: ShoppingList) -> Result<(), Error> { ::handle(self, ctx, message).await } } ``` This avoids having to manually match on enum variants or duplicate message logic. ## When to use it Use `#[forward(MessageType)]` when: - You’ve defined a custom trait (e.g., `ShoppingListHandler`) - You’re handling a message enum (like `ShoppingList`) - You want the runtime to route messages to your trait automatically. This is most often used alongside `#[derive(Handler)]`, which generates the corresponding handler and client traits for a user-defined message enum.