basic-router: Update.

pull/13/head
Jim Blandy 3 years ago
parent 7f7597a656
commit fd7632bb9b

@ -2,5 +2,6 @@
name = "basic-router"
version = "0.1.0"
authors = ["You <you@example.com>"]
edition = "2018"
[dependencies]

@ -15,7 +15,7 @@ struct Response {
body: Vec<u8>
}
type BoxedCallback = Box<Fn(&Request) -> Response>;
type BoxedCallback = Box<dyn Fn(&Request) -> Response>;
struct BasicRouter {
routes: HashMap<String, BoxedCallback>
@ -35,6 +35,7 @@ impl BasicRouter {
}
}
impl BasicRouter {
fn handle_request(&self, request: &Request) -> Response {
match self.routes.get(&request.url) {

Loading…
Cancel
Save