You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 a Builder<AddrIncoming, E>) bound to before calling Builder::serve so that I can pass the local address to the service I'm about to pass into serve.
Describe the solution you'd like
Add fn local_addr(&self) -> SocketAddr to impl Builder<AddrIncoming, E>.
Describe alternatives you've considered
Provide a way to access the full AddrIncoming via Builder, 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 to Builder::serve to get a Server (which does provide local_addr).
The text was updated successfully, but these errors were encountered:
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
).The text was updated successfully, but these errors were encountered: