pub trait ForkStream: Stream<Item: Clone> + Sized {
// Provided method
fn fork(self) -> CloneStream<Self> { ... }
}
Expand description
A trait that turns a Stream
with cloneable Item
s into a cloneable stream
that yields items of the same original item type.
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 uncloneable_stream = stream::iter(0..10);
let cloneable_stream = uncloneable_stream.fork();
let mut cloned_stream = cloneable_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.