routing-match 0.1.0

A simple route match utils
Documentation
  • Coverage
  • 47.62%
    10 out of 21 items documented0 out of 8 items with examples
  • Size
  • Source code size: 7.58 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.19 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 13s Average build duration of successful builds.
  • all releases: 13s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • xiaoquanjie

一个简单的路由匹配工具

fn main() {
    let r = Router::<()>::new();
    // static
    r.add("/static", ());
    // wildcard
    r.add("/home/*", ());
    // Dynamic
    r.add("/dynamic/:page", ());
    
    println!("{:?}", r.go_match("/static"));
    println!("{:?}", r.go_match("/static2"));
    println!("{:?}", r.go_match("/dynamic/wo"));
    println!("{:?}", r.go_match("/home/path1/path2"));
    println!("{:?}", r.remove("/home"));
    println!("{:?}", r.remove("/home/*"));
}