Skip to content

Commit

Permalink
update wildcard docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ibraheemdev committed May 23, 2023
1 parent 8b97cd9 commit 617e745
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,11 @@ Catch-all parameters start with `*` and match everything after the `/`. They mus
let mut m = Router::new();
m.insert("/*p", true)?;
assert_eq!(m.at("/")?.params.get("p"), Some(""));
assert_eq!(m.at("/foo.js")?.params.get("p"), Some("foo.js"));
assert_eq!(m.at("/c/bar.css")?.params.get("p"), Some("c/bar.css"));
// note that this would not match:
assert_eq!(m.at("/").is_err());
```

## Routing Priority
Expand Down
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@
//! assert_eq!(m.at("/foo.js")?.params.get("p"), Some("foo.js"));
//! assert_eq!(m.at("/c/bar.css")?.params.get("p"), Some("c/bar.css"));
//!
//! // note that this would not match
//! assert!(m.at("/").is_err());
//!
//! # Ok(())
//! # }
//! ```
Expand Down

0 comments on commit 617e745

Please sign in to comment.