-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Make axum generic over it's Listener type #2643
Conversation
The idea is that the new |
Huh, somehow I didn't see those |
That's unfortunate. I recommend next time you open an issue to discuss any non-trivial changes before making a PR. As for this change, is it okay if I close this as duplicate? Maybe your work on this could still be useful if it leads to any useful feedback on the other PR, if you want to check for any noteworthy differences and leave a review there that would be appreciated. |
Motivation
I'd like making
axum
applications powered by Unix Sockets to be easier than having to make your own event loop from scratch. This PR allows you to put aUnixListener
inaxum::serve
, or any other type that you implementAccept
on.Solution
This PR adds the
Accept
trait, which abstracts over theaccept()
function of the Listener type. This PR also adds theLocalAddr
trait, which get's the associated Listener's Socket type'sSocketAddr
by calling thelocal_addr()
function on the type. From there, changes were made all around the codebase to make sure that any type implementingAccept
could be put intoaxum::serve