#[get]Expand description
Declares a GET operation.
#[get("/users/{id}", id = "users.read", summary = "Read a user")]
async fn read_user(Path(id): Path<u64>) -> Json<UserView> { .. }The path is positional and first. id is required and is the operation’s
stable identity: it names the operation in the contract, in OpenAPI, in the
generated documentation, in compatibility reports, and as the MCP tool name,
so it must outlive changes to the path and to the function name. summary
is optional and supplies the one-line description that reaches the OpenAPI
operation, the cargo blazingly routes table, and the MCP tool description.
Handler arguments are the extractors — Path, Query, Header, Cookie,
Json, Form, Multipart, File, Extract<T> — and compiled dependency
requests, in any combination. The return type declares the response
contract. The handler may be async or plain fn; a plain fn runs inline
on the calling thread and is never moved to the blocking pool, so work that
genuinely blocks must call run_blocking.
This is an alias for operation with the method fixed.