Skip to main content

is_http3_version

Attribute Macro is_http3_version 

Source
#[is_http3_version]
Expand description

Restricts function execution to HTTP/3 requests only.

This attribute macro ensures the decorated function only executes for HTTP/3 protocol requests, the latest version of the HTTP protocol.

ยงUsage

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

#[route("/is_http3_version")]
struct Http3;

impl ServerHook for Http3 {
    async fn new(_: &mut Stream, _: &mut Context) -> Self {
        Self
    }

    #[prologue_macros(is_http3_version, response_body("is_http3_version"))]
    async fn handle(self, stream: &mut Stream, ctx: &mut Context) -> Status { Status::Continue }
}

impl Http3 {
    #[is_http3_version]
    async fn http3_version_with_ref_self(&self, stream: &mut Stream, ctx: &mut Context) -> Status { Status::Continue }
}

#[is_http3_version]
async fn standalone_http3_version_handler(stream: &mut Stream, ctx: &mut Context) -> Status { Status::Continue }

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