Function unique_port::get_unique_free_port[][src]

pub fn get_unique_free_port() -> Result<u16, String>
Expand description

Returns a free unique local port. Every time a call to this function during one run should return a unique address.

Examples

use unique_port::get_unique_free_port;

let port_1 = get_unique_free_port().unwrap();
let port_2 = get_unique_free_port().unwrap();
assert_ne!(port_1, port_2);