hyper icon indicating copy to clipboard operation
hyper copied to clipboard

`ToSocketAddrs` in `Server::bind()` and `Server::try_bind()`

Open ricvelozo opened this issue 3 years ago • 4 comments
trafficstars

Is your feature request related to a problem? Please describe. Reduce boilerplate, like the actix-web and the std lib too. Currently it needs:

let addr = SocketAddr::from(("127.0.0.1", 8080));
Server::bind(&addr)

Describe the solution you'd like

pub fn bind<A: ToSocketAddrs>(addr: A) -> Builder<AddrIncoming> { /* ... */ }

// Will allow:
Server::bind(("127.0.0.1", 8080))

ricvelozo avatar Oct 02 '22 06:10 ricvelozo

Thanks for the suggestion.

We are moving Server and bunch of other high level stuff to hyper-util crate. This would be a good addition for the new server.

programatik29 avatar Nov 18 '22 06:11 programatik29

I'd like to have a go at this if that's okay, don't seem to be able to assign to myself though?

isabelleatkins avatar May 19 '23 15:05 isabelleatkins

I think the types in hyper-util aren't that planned out yet. It'd be helpful to plan what types and APIs should exist.

seanmonstar avatar May 19 '23 15:05 seanmonstar

@seanmonstar Auto connection PR needs to be merged first.

programatik29 avatar May 19 '23 15:05 programatik29