hyper
hyper copied to clipboard
`ToSocketAddrs` in `Server::bind()` and `Server::try_bind()`
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))
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.
I'd like to have a go at this if that's okay, don't seem to be able to assign to myself though?
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 Auto connection PR needs to be merged first.