Skip to main content

Crate hyperlane_macros

Crate hyperlane_macros 

Source
Expand description

hyperlane-macros

A comprehensive collection of procedural macros for building HTTP servers with enhanced functionality.

Macros§

context
Generates a context reference binding statement.

Attribute Macros§

attribute
Extracts a specific attribute value into a variable with panic on missing value.
attributes
Extracts all attributes into a ThreadSafeAttributeStore variable.
clear_response_headers
Clears all response headers.
closed
Handles closed connection scenarios.
epilogue_hooks
Executes multiple specified functions after the main handler function.
epilogue_macros
Injects a list of macros after the decorated function.
filter
Filters requests based on a boolean condition.
flush
Flushes the response stream after function execution.
host
Restricts function execution to requests with a specific host.
hyperlane
Creates a new instance of a specified type with a given variable name.
import
Imports a path anonymously at the top of the decorated function body.
is_connect_method
Restricts function execution to HTTP CONNECT requests only.
is_delete_method
Restricts function execution to HTTP DELETE requests only.
is_get_method
Restricts function execution to HTTP GET requests only.
is_h2c_upgrade_type
Restricts function execution to HTTP/2 Cleartext (is_h2c_upgrade_type) requests only.
is_head_method
Restricts function execution to HTTP HEAD requests only.
is_http0_9_version
Restricts function execution to HTTP/0.9 requests only.
is_http1_0_version
Restricts function execution to HTTP/1.0 requests only.
is_http1_1_or_higher_version
Restricts function execution to HTTP/1.1 or higher protocol versions.
is_http1_1_version
Restricts function execution to HTTP/1.1 requests only.
is_http2_version
Restricts function execution to HTTP/2 requests only.
is_http3_version
Restricts function execution to HTTP/3 requests only.
is_http_version
Restricts function execution to standard HTTP requests only.
is_options_method
Restricts function execution to HTTP OPTIONS requests only.
is_patch_method
Restricts function execution to HTTP PATCH requests only.
is_post_method
Restricts function execution to HTTP POST requests only.
is_put_method
Restricts function execution to HTTP PUT requests only.
is_tls_upgrade_type
Restricts function execution to TLS-encrypted requests only.
is_trace_method
Restricts function execution to HTTP TRACE requests only.
is_unknown_method
Restricts function execution to unknown HTTP methods only.
is_unknown_upgrade_type
Restricts function execution to requests with unknown protocol upgrade types only.
is_unknown_version
Restricts function execution to requests with unknown HTTP versions only.
is_ws_upgrade_type
Restricts function execution to WebSocket upgrade requests only.
methods
Allows function to handle multiple HTTP methods.
prologue_hooks
Executes multiple specified functions before the main handler function.
prologue_macros
Injects a list of macros before the decorated function.
referer
Restricts function execution to requests with a specific referer.
reject
Rejects requests based on a boolean condition.
reject_host
Reject requests that have no host header.
reject_referer
Reject requests that have a specific referer header.
request_body
Extracts the raw request body into a specified variable.
request_body_json
Parses the request body as JSON into a specified variable and type with panic on parsing failure.
request_body_json_result
Parses the request body as JSON into a specified variable and type with panic on parsing failure.
request_cookie
Extracts a specific cookie value or all cookies into a variable with panic on missing value.
request_cookies
Extracts all cookies as a raw string into a variable.
request_error
Registers a function as a request error hook.
request_error_data
Extracts request error data into a variable with panic on missing value.
request_header
Extracts a specific HTTP request header into a variable with panic on missing value.
request_headers
Extracts all HTTP request headers into a collection variable.
request_middleware
Registers a function as a request middleware.
request_path
Extracts the HTTP request path into a variable.
request_query
Extracts a specific request query parameter into a variable with panic on missing value.
request_querys
Extracts all request query parameters into a RequestQuerys variable.
request_version
Extracts the HTTP request version into a variable.
response_body
Sets the HTTP response body.
response_header
Sets or replaces a specific HTTP response header.
response_middleware
Registers a function as a response middleware.
response_reason_phrase
Sets the HTTP reason phrase for the response.
response_status_code
Sets the HTTP status code for the response.
response_version
Sets the HTTP response version.
route
Registers a function as a route handler.
route_param
Extracts a specific route parameter into a variable with panic on missing value.
route_params
Extracts all route parameters into a collection variable.
send
Automatically sends data via stream after function execution.
task_panic
Registers a function as a panic hook.
task_panic_data
Extracts panic data into a variable with panic on missing value.
try_flush
Tries to flush the response stream after function execution.
try_get_attribute
Extracts a specific attribute value into a variable wrapped in Option type.
try_get_http_request
Wraps function body with HTTP stream processing.
try_get_request_cookie
Extracts a specific cookie value or all cookies into a variable wrapped in Option type.
try_get_request_error_data
Extracts request error data into a variable wrapped in Option type.
try_get_request_header
Extracts a specific HTTP request header into a variable wrapped in Option type.
try_get_request_query
Extracts a specific request query parameter into a variable wrapped in Option type.
try_get_route_param
Extracts a specific route parameter into a variable wrapped in Option type.
try_get_task_panic_data
Extracts panic data into a variable wrapped in Option type.
try_get_websocket_request
Wraps function body with WebSocket stream processing.
try_send
Automatically tries to send data via stream after function execution.