You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Flattening a stream of streams into a single stream provides an opportunity for concurrency if you don't care about the output order of the final stream. An efficient solution is difficult to realize with the built-in combinators.
StreamExt::flat_map doesn't offer any concurrency
stream::select_all requires collecting the stream of streams into an iterable.
Using StreamAll directly can be done with StreamExt::collect, but it still requires collecting all streams from the stream of streams first before processing any of the output items.
What is really desired in this case is a combinator that introduces concurrency both within the set of streams yielded by the stream of streams and with the stream of streams itself. Something like (pseudocode)
let stream_of_streams = ...;
let accumulated_streams = SelectAll::new();
loop {
match select(stream_of_streams.next(), accumulated_streams.next()).await {
StreamOfStreamsBranch(new_stream) => accumulated_streams.push(new_stream);
AccumulatedStreamsBranch(item_to_pass_along) => break item_to_pass_along,
}
}
The text was updated successfully, but these errors were encountered:
(Inspired by the twitter thread at https://twitter.com/RReverser/status/1374544426622726145)
Flattening a stream of streams into a single stream provides an opportunity for concurrency if you don't care about the output order of the final stream. An efficient solution is difficult to realize with the built-in combinators.
What is really desired in this case is a combinator that introduces concurrency both within the set of streams yielded by the stream of streams and with the stream of streams itself. Something like (pseudocode)
The text was updated successfully, but these errors were encountered: