reset-recognizer

Docs Crates.io

A fast RegexSet based path router, in the style of route-recognizer.

reset-router, a higher level path router for use with Hyper 0.12, uses this library internally.

Usage:

```rust let router = resetrecognizer::Router::build() .add(r"^/posts/(.+)/comments/(.+)$", "comment".tostring()) .add(r"^/posts/(.+)/comments$", "comments".tostring()) .add(r"^/posts/(.+)$", "post".tostring()) .add(r"^/posts$", "posts".tostring()) .add(r"^/comments$", "comments2".tostring()) .add(r"^/comments/(.+)$", "comment2".tostring()) .addwithpriority(r"^/(.+)$", 1, "notfound".to_string()) .finish()?;

let matched = router.recognize("/posts/100/comments/200")?;

let (postid, commentid) = matched.captures.parsed::<(i32, i32)>()?;

println!("{:?}", (&matched.handler, &postid, &commentid)); ```

Current version: 0.7.2

License: MIT