4 releases
Uses new Rust 2024
0.1.3 | Apr 2, 2025 |
---|---|
0.1.2 | Apr 2, 2025 |
0.1.1 | Apr 2, 2025 |
0.1.0 | Apr 2, 2025 |
#2559 in Procedural macros
375 downloads per month
Used in axum-distributed-routing
17KB
329 lines
Axum Distributed Routing
Warning
This crate is experimental, use at your own risk!
Provides utilities for generating statically typed distributed routes for axum.
Usage
use axum_distributed_routing::*;
struct MyState(String);
route_group!(MyRoutes, MyState);
route!(
group = MyRoutes,
path = "/hello/{name:String}",
method = GET,
async hello -> String {
format!("{} {}!", state.0, name)
}
);
#[tokio::main]
async fn main() {
let app = create_router!(MyRoutes);
let listener = tokio::net::TcpListener::bind("127.0.0.1:3000").await.unwrap();
axum::serve(listener, app).await.unwrap();
}
Dependencies
~0.8–1.2MB
~29K SLoC