async-rs / async-std

Async version of the Rust standard library

Home Page:https://async.rs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Transform TcpListener into Stream of connections

piegamesde opened this issue · comments

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.

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

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

commented

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?

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