How to product two streams?

I know Stream in async rust is like the iterator in sync rust.

I can use itertools::product([1,2], [3,4]) to produce a iterator over items [(1,3),(1,4),(2,3),(2,4)]. How can I do that for two streams?

This is somewhat interesting to think about actually, because to implement it, you basically have to cache the entire contents of the second string so you can repeat it, and so a lot of the items wont really be as async.

Anyway, I'm not aware of any standard combinator for this. You could use async-stream to write it yourself I guess.


So, is rust a language which is suitable for dealing with streaming work, e.g. Distributed Query Engine

Sure, there's no problem. That nobody has implemented this doesn't mean it could not exist.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.