How can I create a stream where the items are based on items that the stream previously returned?
问题 I have a function that generates a futures::Stream based on an argument. I want to call this function multiple times and flatten the streams together. Complicating matters is the fact that I want to feed the values returned by the stream back as the argument to the original function. Concretely, I have a function that returns a stream of numbers down to zero: fn numbers_down_to_zero(v: i32) -> impl Stream<Item = i32> { stream::iter((0..v).rev()) } I want to call this function starting at 5.