pub trait ForkStream: Stream<Item: Clone> + Sized {
// Provided method
fn fork(self) -> CloneStream<Self> { ... }
}
Expand description
A trait that turns an input Stream
with Stream::Item
s that implement
Clone
into a stream that is Clone
. The output stream yields items of
the same type as the input stream.
Provided Methods§
Sourcefn fork(self) -> CloneStream<Self>
fn fork(self) -> CloneStream<Self>
Forks the stream into a new stream that can be cloned.
§Example
use clone_stream::ForkStream;
use futures::{FutureExt, StreamExt, stream};
let non_clone_stream = stream::iter(0..10);
let clone_stream = non_clone_stream.fork();
let mut cloned_stream = clone_stream.clone();
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.