Skip to content

async_std::Stream interracts badly with futures::select! #23

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

Closed
matklad opened this issue Aug 14, 2019 · 2 comments
Closed

async_std::Stream interracts badly with futures::select! #23

matklad opened this issue Aug 14, 2019 · 2 comments

Comments

@matklad
Copy link
Member

matklad commented Aug 14, 2019

futures::select! requires that the streams selected over implement futures::FusedStream. There's a .fuse() method on futures::StreamExt which fuses any stream. The problem is, to use StreamExt::fuse on has to import this trait, and then the .next method collides between async_std::Stream and futures::StreamExt.

See also async-rs/a-chat#1 (comment)

@yoshuawuyts
Copy link
Contributor

There's relevant discussion on join and select in #14.

@yoshuawuyts
Copy link
Contributor

We now have async-macros which has stream::join that allows bypassing the problems futures_preview::select has.

The pattern is to define an enum of event kinds, and then map each individual stream to be a member of that enum. Then using async iteration + match the same semantics can be achieved as futures_preview::select.

Going to go ahead and close this!

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

No branches or pull requests

2 participants