routing-match 0.2.0

A simple route match utils
Documentation
  • Coverage
  • 30.77%
    4 out of 13 items documented0 out of 12 items with examples
  • Size
  • Source code size: 5.82 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.66 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 14s 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("/static"));
    println!("{:?}", r.go("/static2"));
    println!("{:?}", r.go("/dynamic/wo"));
    println!("{:?}", r.go("/home/path1/path2"));
    println!("{:?}", r.remove("/home"));
    println!("{:?}", r.remove("/home/*"));
}