pub fn set_port_index(pindex: u16) -> Result<(), String>
Expand description

Sets the port number, from which get_unique_free_port() will start generating free ports incrementally.

Examples

use unique_port;

// this may fail if port number 1042 is not free.

let pindex = 1042;

unique_port::set_port_index(pindex).unwrap();
assert_eq!(pindex, unique_port::get_unique_free_port().unwrap());

unique_port::set_port_index(pindex).unwrap();
assert_eq!(pindex, unique_port::get_unique_free_port().unwrap());