Procedural macro attributes for rust-web-server.
Import via the main crate with features = ["macros"]:
[]
= { = "17", = ["macros"] }
Attributes
| Attribute | Equivalent |
|---|---|
#[route(GET, "/path")] |
generic; any method |
#[get("/path")] |
shorthand for GET |
#[post("/path")] |
shorthand for POST |
#[put("/path")] |
shorthand for PUT |
#[patch("/path")] |
shorthand for PATCH |
#[delete("/path")] |
shorthand for DELETE |
All attributes add a Route: METHOD /path doc-comment and leave the
function body completely unchanged. They work with named functions used
as handlers in routes! or registered directly with .get(), .post(), etc.