mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-29 00:00:18 +02:00
Support wildcards in typed paths (#1003)
* Support wildcards in typed paths * changelog
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
use axum_extra::routing::TypedPath;
|
||||
|
||||
#[derive(TypedPath)]
|
||||
#[typed_path("/users/*rest")]
|
||||
struct MyPath;
|
||||
|
||||
fn main() {}
|
||||
@@ -1,5 +0,0 @@
|
||||
error: `typed_path` cannot contain wildcards
|
||||
--> tests/typed_path/fail/wildcard.rs:4:14
|
||||
|
|
||||
4 | #[typed_path("/users/*rest")]
|
||||
| ^^^^^^^^^^^^^^
|
||||
@@ -0,0 +1,12 @@
|
||||
use axum_extra::routing::{RouterExt, TypedPath};
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(TypedPath, Deserialize)]
|
||||
#[typed_path("/*rest")]
|
||||
struct MyPath {
|
||||
rest: String,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
axum::Router::<axum::body::Body>::new().typed_get(|_: MyPath| async {});
|
||||
}
|
||||
Reference in New Issue
Block a user