This is particularly nice for is to go from multiple internal streams -> a single external stream. A pattern is to define a single Event type that enumerates all different events, and `map` each individual stream to the enum kind, and then join it to get a single stream.
-
-
Show this thread
-
This stream can then be consumed using `match` for each individual event kind. Similar to Go's `select` keyword!
Show this thread -
Quick addendum: async_std's `stream::once` method doesn't require a Future to be passed, which means the example is actually even nicer:pic.twitter.com/9ECteX5EbN
Show this thread
End of conversation
New conversation -
-
-
Why not call it chain/zip/select? Im confused
-
If we follow std::iter::Iterator's semantics: - Stream::chain exhausts the first stream before polling the second. - Stream::zip returns tuples containing output of both streams. We're already using `select` to pick the first completed future out of a set. This is different.
- 1 more reply
New conversation -
-
-
nice this is just like the pumpify module
-
Heh yeah; slowly getting to feature parity with Node streams. Got an equivalent of concat-stream working also: https://github.com/async-rs/async-std/pull/125 … Also have a design in place to conveniently enable multi-core stream processing which I'll be working on the rest of today :D
End of conversation
New conversation -
-
-
Omgggggg
-
Yessss :D
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.