New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an Either type for Listeners #4048
Comments
Adding this to |
I am working on this. |
@Darksonn When you have time, could you help describe what you think the right API looks like? |
Well there are probably several options. You could have an enum with the listener types hard-coded. You could also define a listener trait, which would have a |
Hi @hi-rustin how's it going with this one? I could have a look at it this week if you like. |
Please note that this PR was recently posted: #4385 |
Fixed in #4385. |
Is your feature request related to a problem? Please describe.
I want to be able to (easily) listen on either a UnixListener or TcpListener in the same function. Or, more precisely, I would like the freedom to nest other types as well, just as can be done with
tokio-util
'sEither
.On the client side we have a function which parses the socket address string and detects if it's a local domain socket or not, and paired with a custom connection function we can easily allow the user to control whether to use local domain sockets or TCP simply by altering a configuration string. We want to be provide the same simplicity on the server end for the binding/listening.
Describe the solution you'd like
It would be nice to have an
EitherListener
(or equivalent) which works exactly liketokio-utik
'sEither
, except that it works on the server end (i.e..bind()
and.accept()
).Describe alternatives you've considered
We have a hardwired solution, but the nice thing about Either is that it generic and supports nested types.
The text was updated successfully, but these errors were encountered: