Attribute Macro poem::handler[][src]

#[handler]
Expand description

Wrap an asynchronous function as an Endpoint.

Attributes

  • method - Add a method guard.
  • host="host name" - Add a host guard.
  • header("header name", "header value) - Add a header value guard.

Example

#[handler(
    method = "get",
    host = "example.com",
    header(name = "Custom-header", value = "true")
)]
async fn example() {
}