3 unstable releases
Uses new Rust 2024
| 0.2.0 | Aug 26, 2025 |
|---|---|
| 0.1.1 | Aug 13, 2025 |
| 0.1.0 | Aug 13, 2025 |
#5 in #个简单
169 downloads per month
5KB
90 lines
一个简单的路由匹配工具
fn main() {
let r = Router::<()>::new();
// static
r.add("/static", ());
// wildcard
r.add("/home/*", ());
// Dynamic
r.add("/dynamic/:page", ());
println!("{:?}", r.go("/static"));
println!("{:?}", r.go("/static2"));
println!("{:?}", r.go("/dynamic/wo"));
println!("{:?}", r.go("/home/path1/path2"));
println!("{:?}", r.remove("/home"));
println!("{:?}", r.remove("/home/*"));
}
Dependencies
~86KB