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?
I am wondering why
ParallelStream
requiresT
to beSync
whereasync_std::task::spawn
requires the spawned future only to beSend + 'static
.I ran into this issue when trying to convert some code that executes the elements of a
Stream
in parallel usingtask::spawn
directly +buffer_unordered
.The
Stream
isSend + 'static
but notSync
and therefore I cannot convert it into aParallelStream
. Why does it need theT
to be thread safe? It shouldn't be shared across the tasks, does it?Trying to use it with this stream.