fn wait_for_port(port: u16) -> Option<()> {
    let mut count = 0;
    loop {
        thread::sleep(time::Duration::from_millis(500));
        if net::TcpStream::connect(("127.0.0.1", port)).is_ok() {
            return Some(());
        }
        count += 1;
        if count == 10 {
            return None;
        }
    }
}
// Wait until we can connect to localhost:port.
Wait until we can connect to localhost:port.
Wait until we can connect to localhost : port .
fn wait_for_port(port: u16) -> Option<()> {
    let mut count = 0;
    loop {
        thread::sleep(time::Duration::from_millis(500));
        if net::TcpStream::connect(("127.0.0.1", port)).is_ok() {
            return Some(());
        }
        count += 1;
        if count == 10 {
            return None;
        }
    }
}
fn wait_for_port ( port : u16 ) -> Option < ( ) > { let mut count = 0 ; loop { thread :: sleep ( time :: Duration :: from_millis ( 500 ) ) ; if net :: TcpStream :: connect ( ( " " , port ) ) . is_ok ( ) { return Some ( ( ) ) ; } count += 1 ; if count == 10 { return None ; } } }
Wait until we can connect to localhost:port.
Wait until we can connect to localhost : port .
port
u16
port
u16