salvo-rs / salvo

A powerful web framework built with a simplified design.
https://salvo.rs
Apache License 2.0
2.92k stars 172 forks source link

Add IpAddr and u16 "constructor" to conn::TcpListener #824

Closed Mek101 closed 5 days ago

Mek101 commented 1 week ago

Could you please add something along the lines of

let ip: IpAddr = IpAddr::V4(Ipv4Addr::UNSPECIFIED);
let port: u16 = 8080;

conn::TcpListener::with(ip, port)

Please?

Right now the alternative is

conn::TcpListener::new(format!("{}:{}", ip.to_string(), port))
chrislearn commented 5 days ago

You can write like this:

TcpListener::new((ip, port));