23 releases

0.4.8 Oct 15, 2025
0.4.6 Sep 19, 2025
0.4.4 Jul 25, 2025
0.3.2 Dec 15, 2024
0.2.0 Sep 28, 2024

#2002 in Procedural macros

Download history 154/week @ 2025-08-13 91/week @ 2025-08-20 135/week @ 2025-08-27 134/week @ 2025-09-03 80/week @ 2025-09-10 251/week @ 2025-09-17 123/week @ 2025-09-24 194/week @ 2025-10-01 248/week @ 2025-10-08 298/week @ 2025-10-15 104/week @ 2025-10-22 52/week @ 2025-10-29 59/week @ 2025-11-05 105/week @ 2025-11-12 146/week @ 2025-11-19 173/week @ 2025-11-26

489 downloads per month
Used in 24 crates (6 directly)

MIT license

115KB
2.5K SLoC

macros for spring.rs.

spring.rs macros re-exports

spring-rs re-exports all macros for this crate, so you usually don't need to explicitly specify this dependency. You can view the re-exported macros at spring-rs.

Web route macros

Single Method Handler

There is a macro to set up a handler for each of the most common HTTP methods.

See docs for: [GET], [POST], [PATCH], [PUT], [DELETE], [HEAD], [OPTIONS], [TRACE]

# use spring_web::axum::response::IntoResponse;
# use spring_macros::get;
#[get("/test")]
async fn get_handler() -> impl IntoResponse {
    "hello world"
}

Multiple Method Handlers

Similar to the single method handler macro but takes one or more arguments for the HTTP methods it should respond to. See [macro@route] macro docs.

# use spring_web::axum::response::IntoResponse;
# use spring_macros::route;
#[route("/test", method = "GET", method = "HEAD")]
async fn get_and_head_handler() -> impl IntoResponse {
    "hello world"
}

Multiple Path Handlers

Acts as a wrapper for multiple single method handler macros. It takes no arguments and delegates those to the macros for the individual methods. See [macro@routes] macro docs.

# use spring_web::axum::response::IntoResponse;
# use spring_macros::routes;
#[routes]
#[get("/test")]
#[get("/test2")]
#[delete("/test")]
async fn example() -> impl IntoResponse {
    "hello world"
}

Dependencies

~140–540KB
~13K SLoC