attributes

Attribute Macro attributes 

Source
#[attributes]
Expand description

Extracts all attributes into a HashMap variable.

This attribute macro retrieves all available attributes from the request context and makes them available as a HashMap for comprehensive attribute access.

ยงUsage

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

#[route("/attributes")]
struct Attributes;

impl ServerHook for Attributes {
    async fn new(_ctx: &Context) -> Self {
        Self
    }

    #[response_body(&format!("request attributes: {request_attributes:?}"))]
    #[attributes(request_attributes)]
    async fn handle(self, ctx: &Context) {}
}

The macro accepts a variable name that will contain a HashMap of all attributes. The variable will be available as a HashMap in the function scope.