mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-04-29 04:59:46 +00:00
7 lines
191 B
Rust
7 lines
191 B
Rust
use std::net::TcpListener;
|
|
|
|
pub fn get_available_port() -> Option<u16> {
|
|
TcpListener::bind(("127.0.0.1", 0))
|
|
.map(|listener| listener.local_addr().unwrap().port())
|
|
.ok()
|
|
} |