Trait StreamUtils

Source
pub trait StreamUtils: Stream {
    // Provided method
    fn copied_multi_stream(self, i: usize) -> Vec<CopiedMultiStream<Self>>
       where Self: Sized { ... }
}
Expand description

A Stream blanket implementation trait that provides extra adaptors.

Provided Methods§

Source

fn copied_multi_stream(self, i: usize) -> Vec<CopiedMultiStream<Self>>
where Self: Sized,

Copies values from the inner stream into multiple new streams. Polls from inner stream one value and waits till all new streams have pulled a copied value. Note that the internal buffer only buffers one value from the inner stream. Not pulling from all new streams in sequence will result in an endless loop polling a Pending state. Essentially blocking.

When the underlying stream terminates, all new streams which have allready pulled the last value will be Pending. When all new streams have pulled the last value, all streams will terminate.

Implementors§