Struct shio::router::Router
[−]
[src]
pub struct Router { /* fields omitted */ }
Methods
impl Router
[src]
fn new() -> Self
[src]
Construct a new, empty Router
.
let router = Router::new();
Equivalent to Router::default()
.
fn add<R: Into<Route>>(&mut self, route: R)
[src]
Add a new route to a Router
, matching both a Method
and a Pattern
. Any value
that implements Into<Route>
may be provided to route
.
For example, to match a Get
request to /users
:
router.route((Method::GET, "/users", |_| { // [...] }));
fn route<R: Into<Route>>(&mut self, route: R)
[src]
Deprecated since 0.0.7
: use Router::add
instead