rws-macros 17.26.0

Procedural macros for rust-web-server (route attributes)
Documentation

Procedural macro attributes for rust-web-server.

Import via the main crate with features = ["macros"]:

[dependencies]
rust-web-server = { version = "17", features = ["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.