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

Transform TcpListener into Stream of connections #981

Closed
piegamesde opened this issue Aug 24, 2021 · 5 comments · Fixed by #995
Closed

Transform TcpListener into Stream of connections #981

piegamesde opened this issue Aug 24, 2021 · 5 comments · Fixed by #995
Labels
enhancement New feature or request

Comments

@piegamesde
Copy link
Contributor

There is TcpListener::incoming that provides this functionality, but it has a lifetime. I cannot simply pass the stream around and manipulate it, because it has 'a lifetime bound to the TcpListener. An alternative that takes over ownership would be appreciated.

Note that this is symmetric to the stdlib, where the same API suffers from the same problem.

@Fishrock123
Copy link
Member

A solution should ideally first be found for the problem in stdlib since async-std tries to mirror the stdlib in async ways.

@Fishrock123 Fishrock123 added the enhancement New feature or request label Aug 25, 2021
@piegamesde
Copy link
Contributor Author

WIP: rust-lang/rust#88373

@piegamesde
Copy link
Contributor Author

The feature got merged, so it could already be implemented behind an unstable flag.

@yoshuawuyts
Copy link
Contributor

The feature got merged, so it could already be implemented behind an unstable flag.

Adding this behind an unstable flag makes sense to me! Would you be willing to a file a PR for that?

@piegamesde
Copy link
Contributor Author

Ugh, apparently since all methods are delegated to Async, I need to make a pull request to async_io first?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants