pub fn unused_port() -> u16 {
    let listener = TcpListener::bind("127.0.0.1:0")
        .expect("Failed to create TCP listener to find unused port");

    let local_addr = listener
        .local_addr()
        .expect("Failed to read TCP listener local_addr to find unused port");
    local_addr.port()
}
/// A bit of hack to find an unused TCP port.
///
/// Does not guarantee that the given port is unused after the function exists, just that it was
/// unused before the function started (i.e., it does not reserve a port).
A bit of hack to find an unused TCP port.
Does not guarantee that the given port is unused after the function exists, just that it was
unused before the function started .
A bit of hack to find an unused TCP port . Does not guarantee that the given port is unused after the function exists just that it was unused before the function started .
pub fn unused_port() -> u16 {
    let listener = TcpListener::bind("127.0.0.1:0")
        .expect("Failed to create TCP listener to find unused port");
    let local_addr = listener
        .local_addr()
        .expect("Failed to read TCP listener local_addr to find unused port");
    local_addr.port()
}
pub fn unused_port ( ) -> u16 { let listener = TcpListener :: bind ( " " ) . expect ( " " ) ; let local_addr = listener . local_addr ( ) . expect ( " " ) ; local_addr . port ( ) }
A bit of hack to find an unused TCP port.
A bit of hack to find an unused TCP port .