Use a generic ToString object in new.

This commit is contained in:
Sergio Benitez 2016-09-08 00:25:40 -07:00
parent 32bf3e1737
commit f259593727

View File

@ -12,7 +12,7 @@ use hyper::server::Server as HyperServer;
use hyper::server::Handler as HyperHandler;
pub struct Rocket {
address: &'static str,
address: String,
port: isize,
router: Router,
catchers: HashMap<u16, Catcher>,
@ -81,9 +81,9 @@ impl Rocket {
catcher.handle(Error::NoRoute, request).respond(response);
}
pub fn new(address: &'static str, port: isize) -> Rocket {
pub fn new<S: ToString>(address: S, port: isize) -> Rocket {
Rocket {
address: address,
address: address.to_string(),
port: port,
router: Router::new(),
catchers: catcher::defaults::get(),