http2

Attribute Macro http2 

Source
#[http2]
Expand description

Restricts function execution to HTTP/2 requests only.

This attribute macro ensures the decorated function only executes for HTTP/2 protocol requests.

ยงUsage

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

#[route("/http2")]
struct Http2;

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

    #[prologue_macros(http2, response_body("http2"))]
    async fn handle(self, ctx: &Context) {}
}

impl Http2 {
    #[http2]
    async fn http2_with_ref_self(&self, ctx: &Context) {}
}

#[http2]
async fn standalone_http2_handler(ctx: &Context) {}

The macro takes no parameters and should be applied directly to async functions that accept a &Context parameter.