#[patch]Expand description
Declares a PATCH handler inside a #[routes] impl block.
#[patch] records PATCH route metadata and is consumed by #[routes] to
build the controller router.
Basic syntax:
ⓘ
#[routes]
impl UsersController {
#[patch("/:id")]
async fn update(&self, Path(id): Path<String>, Json(input): Json<UpdateUser>) -> Json<UserDto> {
Json(self.service.update(id, input).await)
}
}Use this macro for partial update endpoints where the handler return type is
any Axum-compatible IntoResponse. Common errors are invalid relative paths
and forgetting that the controller prefix is prepended by generated router
construction.