Since I basically copied and adapted the corresponding functionality from future, I am not entirely sure if the terminology and examples match the style of the stream module.
In any case, it seems to work as expected, and reads nicely in code. For example, I was able to turn this…
let mut events = futures_util::stream::select_all(vec![
ticker(duration_per_frame).map(|_| Event::Tick).boxed(),
key_receive.map(Event::Input).boxed(),
events.boxed(),
]);
…into this…
let mut events = ticker(duration_per_frame)
.map(|_| Event::Tick)
.or(key_receive.map(Event::Input))
.or(events);
Fixes #2
PS: Feel free to squash, I tend to commit every tiny step out of fear I loose a 'good' state :D
Since I basically copied and adapted the corresponding functionality from
future
, I am not entirely sure if the terminology and examples match the style of the stream module. In any case, it seems to work as expected, and reads nicely in code. For example, I was able to turn this……into this…
Fixes #2
PS: Feel free to squash, I tend to commit every tiny step out of fear I loose a 'good' state :D