Skip to content
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

feat(util): impl listener for either #6206

Conversation

saiintbrisson
Copy link
Contributor

Implements the Listener trait for Either. This will ease
adding support for features such as #5678. Allowing users
to accept sockets from any of the two underlying listener
types, like Either<UnixListener, TcpListener>.

Closes #6201.

@Darksonn Darksonn added A-tokio-util Area: The tokio-util crate M-net Module: tokio/net labels Dec 10, 2023
@Darksonn
Copy link
Contributor

Hmm, I didn't realize that we already have non-trait methods for this.

This makes it more tricky because we shouldn't introduce a breaking change.

@saiintbrisson
Copy link
Contributor Author

Indeed more tricky, but that was my reasoning behind leaving the original methods. local_addr remains with the same interface, and accept still has an equivalent future and output, unless there's something I'm not seeing.

Probably consider introducing a deprecation notice for local_addr?

@Darksonn
Copy link
Contributor

Actually, this does change the return type of accept from Result<Either<(L::Io, L::Addr), (R::Io, R::Addr)>> to Result<(Either<L::Io, R::Io>, Either<L::Addr, R::Addr>)>.

@Darksonn
Copy link
Contributor

I'm sorry, but I'm going to close this due to the existing methods.

Sorry for not double-checking this before opening the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio-util Area: The tokio-util crate M-net Module: tokio/net
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Listener for Either
2 participants