#router

rs-router

A RegexSet based path router for Hyper

1 unstable release

Uses old Rust 2015

0.1.1 Apr 11, 2017

#218 in #router

MIT license

14KB
306 lines

rs-router

A RegexSet based router for use with stable Hyper (0.10.x).

The rs stands for RegexSet, not Rust—

Similar to and inspired by reroute, but potentially faster (no unnecessary string allocations, no hashmaps, and method-first-matching).

Provides light wrappers around hyper::server::Request and hyper::server::Response

  • to provide some convenience methods, like req.captures(), which provides the captures of the matching Regex,
  • and to enable nice request handlers with signature fn(req: Request) -> Result<Response, Error> where Error implements Into<Response> (which allows you to bail out of the handler early on errors).

See /examples/simple.rs for usage.

Dependencies

~8MB
~175K SLoC