Support wildcards in typed paths (#1003)

* Support wildcards in typed paths

* changelog
This commit is contained in:
David Pedersen
2022-05-06 13:05:30 +02:00
committed by GitHub
parent 4ff78e552d
commit b5183afbec
6 changed files with 20 additions and 20 deletions
@@ -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 {});
}