Trait ForkStream

Source
pub trait ForkStream: Stream<Item: Clone> + Sized {
    // Provided method
    fn fork(self) -> CloneStream<Self> { ... }
}
Expand description

A trait that turns a Stream with cloneable Items into a cloneable stream that yields items of the same original item type.

Provided Methods§

Source

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.

Implementors§

Source§

impl<BaseStream> ForkStream for BaseStream
where BaseStream: Stream<Item: Clone>,