Heh, found a neat pattern today. To add an item to a stream after it's finished (useful when joining streams) you can use `.chain`: let s = s.chain(stream::once(1u8)); If you then run this through stream::join, you can ensure that each individual stream emits a msg on close
-
-
let a = stream::repeat(1u8).take(2); let a = a.chain(stream::once(2u8)); let b = stream::repeat(3u8).take(2); let b = b.chain(stream::once(4u8)); let s = a.merge(b); s.for_each(|num| dbg!(num)).await; // => 1, 1, 2, 3, 3, 4
Show this threadThanks. Twitter will use this to make your timeline better. UndoUndo
-
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.