docs(axum): document that path must start with / in Router::route (#3771)

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
吴杨帆
2026-05-17 10:51:06 +02:00
committed by GitHub
co-authored by Cursor
parent 16313be447
commit c21fcae087
+3 -1
View File
@@ -176,4 +176,6 @@ let app = Router::new()
The static route `/foo` and the dynamic route `/{key}` are not considered to
overlap and `/foo` will take precedence.
Also panics if `path` is empty.
Also panics if `path` is empty or does not start with `/` (for example `"Cargo.lock"`).
When nesting routers with [`Router::nest`](crate::Router::nest), nested paths are still
relative segments and must start with `/` (use `"/Cargo.lock"` rather than `"Cargo.lock"`).