change format! to concat() and modify listen() to take &String instead of String

master
rasul 4 years ago
parent f0aa9fc33e
commit 2d19be25d9

@ -36,8 +36,8 @@ impl Game {
tokens.push_back(Token(i));
}
let server_address = format!("{}:{}", config.server.ip, config.server.port);
let mut server = Server::listen(server_address.clone(), Token(0))?;
let server_address = [&config.server.ip, ":", &config.server.port.to_string()].concat();
let mut server = Server::listen(&server_address, Token(0))?;
info!("Listening on {}", &server_address);
let poll = try_log!(Poll::new(), "Unable to create Poll");

@ -27,7 +27,7 @@ pub struct Server {
impl Server {
/// Bind to the provided address
pub fn listen<'a>(addr: String, token: Token) -> RudeResult<Server> {
pub fn listen<'a>(addr: &String, token: Token) -> RudeResult<Server> {
let addr: SocketAddr = try_log!(addr.parse(), "Unable to parse server address: {}", &addr);
let socket: TcpListener = try_log!(

Loading…
Cancel
Save