Created
June 4, 2014 21:33
-
-
Save jroweboy/f830462ccd048725433e to your computer and use it in GitHub Desktop.
Quick Fix?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
impl Server { | |
fn new(route_store: Arc<RWLock<RouteStore>>) -> Server { | |
Server { | |
route_store: route_store | |
} | |
} | |
} | |
impl Floor { | |
pub fn get(&mut self, uri: &str, handler: fn(request: &Request, response: &mut ResponseWriter) -> ()){ | |
self.route_store.routes.insert(String::from_str(uri), handler); | |
} | |
pub fn new() -> Floor { | |
Floor { | |
route_store: Arc::new(RWLock::new(RouteStore::new())), | |
server: None | |
} | |
} | |
//why do we need this. Is serve_forever like a protected method in C# terms? | |
pub fn run(&mut self) -> () { | |
self.server = Some(Server::new(self.route_store.clone())); | |
self.server.unwrap().serve_forever(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment