Crate hyperlane_macros

Crate hyperlane_macros 

Source
Expand description

hyperlane-macros

A comprehensive collection of procedural macros for building HTTP servers with enhanced functionality. This crate provides attribute macros that simplify HTTP request handling, protocol validation, response management, and request data extraction.

Attribute Macrosยง

aborted
Handles aborted request scenarios.
attribute
Extracts a specific attribute value into a variable.
attributes
Extracts all attributes into a HashMap variable.
closed
Handles closed connection scenarios.
connect
Restricts function execution to HTTP CONNECT requests only.
connected_hook
Registers a function as a connected hook.
delete
Restricts function execution to HTTP DELETE requests only.
disable_http_hook
Disables the default HTTP hook.
disable_ws_hook
Disables the default WebSocket hook.
epilogue_hook
Executes a specified function after the main handler function.
epilogue_hooks
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.
get
Restricts function execution to HTTP GET requests only.
h2c
Restricts function execution to HTTP/2 Cleartext (h2c) requests only.
head
Restricts function execution to HTTP HEAD requests only.
host
Restricts function execution to requests with a specific host.
http
Restricts function execution to standard HTTP requests only.
http0_9
Restricts function execution to HTTP/0.9 requests only.
http2
Restricts function execution to HTTP/2 requests only.
http3
Restricts function execution to HTTP/3 requests only.
http1_0
Restricts function execution to HTTP/1.0 requests only.
http1_1
Restricts function execution to HTTP/1.1 requests only.
http1_1_or_higher
Restricts function execution to HTTP/1.1 or higher protocol versions.
hyperlane
Creates a new instance of a specified type with a given variable name.
methods
Allows function to handle multiple HTTP methods.
options
Restricts function execution to HTTP OPTIONS requests only.
panic_hook
Registers a function as a panic hook.
patch
Restricts function execution to HTTP PATCH requests only.
post
Restricts function execution to HTTP POST requests only.
prologue_hook
Executes a specified function before the main handler function.
prologue_hooks
Injects a list of macros before the decorated function.
prologue_upgrade_hook
Registers a function as a pre-upgrade hook.
put
Restricts function execution to HTTP PUT requests only.
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.
request_cookie
Extracts a specific cookie value or all cookies into a variable.
request_cookies
Extracts all cookies as a raw string into a variable.
request_header
Extracts a specific HTTP request header into a variable.
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.
request_querys
Extracts all request query parameters into a collection 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.
route_params
Extracts all route parameters into a collection variable.
send
Automatically sends the complete response after function execution.
send_body
Automatically sends only the response body after function execution.
send_once
Sends the complete response exactly once after function execution.
send_once_body
Sends only the response body exactly once after function execution.
tls
Restricts function execution to TLS-encrypted requests only.
trace
Restricts function execution to HTTP TRACE requests only.
ws
Restricts function execution to WebSocket upgrade requests only.