Closed jonhoo closed 1 year ago
The implementation is simple, the question is whether adding a new public API to v0.14.x
is worth it during v1.0
effort.
I think this can now be closed since https://github.com/hyperium/hyper/pull/3278 landed?
I think Sean is waiting untill the patch with the change is realeased? Not sure what the process is.
Oh, nope, it just doesn't auto-close become it was merged to a different branch, not master. We can close! (And I'll schedule a 0.14 release this week, cleaning through inbox.)
Is your feature request related to a problem? Please describe. I'd like to be able to get the local address that
Server::bind
(which returns aBuilder<AddrIncoming, E>
) bound to before callingBuilder::serve
so that I can pass the local address to the service I'm about to pass intoserve
.Describe the solution you'd like Add
fn local_addr(&self) -> SocketAddr
toimpl Builder<AddrIncoming, E>
.Describe alternatives you've considered Provide a way to access the full
AddrIncoming
viaBuilder
, but that feels probably excessive.Additional context This is particularly relevant when the address passed to bind uses port
0
. This comes up for me occasionally in tests where I want the test service to be aware of its own port number (to, e.g., echo back in a HTML body), which means I need to know the port before I can construct the service to pass toBuilder::serve
to get aServer
(which does providelocal_addr
).