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

Requiring T to be Sync prevents use cases that work with task:spawn #17

Open
athei opened this issue Sep 21, 2020 · 0 comments
Open

Requiring T to be Sync prevents use cases that work with task:spawn #17

athei opened this issue Sep 21, 2020 · 0 comments

Comments

@athei
Copy link

athei commented Sep 21, 2020

I am wondering why ParallelStream requires T to be Sync where async_std::task::spawn requires the spawned future only to be Send + 'static.

I ran into this issue when trying to convert some code that executes the elements of a Stream in parallel using task::spawn directly + buffer_unordered.

The Stream is Send + 'static but not Sync and therefore I cannot convert it into a ParallelStream. Why does it need the T to be thread safe? It shouldn't be shared across the tasks, does it?

Trying to use it with this stream.

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

1 participant