pub trait SharedStreamExt<'a>: Stream + Send{
// Required method
fn share(
self,
capacity: Capacity,
) -> (SharedStream<'a, Self::Item>, SharedStream<'a, Self::Item>);
}
Required Methods§
Split a stream into two shared streams
Each shared stream will return the full set of items from the underlying stream. This works by buffering the items from the underlying stream and then replaying them to the other side.
The capacity parameter controls how many items can be buffered at once. Be careful with the capacity parameter as it can lead to deadlock if the two streams are not polled evenly.
If the capacity is unbounded then the stream could potentially buffer the entire input stream in memory.