Crate clone_stream

Crate clone_stream 

Source
Expand description

§Clone streams with clone-stream

Lazy single-threaded stream cloning: items are only cloned when a consumer actually polls for them.

The CloneStream struct implements Clone + Stream, allowing you to create multiple concurrent consumers. The ForkStream trait provides the entry point via the fork() method.

§How It Works

Unlike broadcast channels that eagerly clone every item for every subscriber, this crate clones on-demand. Items are delivered only to clones actively polling when items arrive (poll-time semantics).

§Important: Single-Threaded Runtime Required

This crate requires single-threaded async runtimes (current_thread flavor or #[tokio::test]). The lazy semantics depend on cooperative scheduling; multi-threaded runtimes cause race conditions.

Modules§

clean_log
ring_queue

Structs§

CloneStream
A cloneable stream that delivers items to consumers polling when items arrive.
ForkConfig

Enums§

CloneStreamError
Errors that can occur when working with cloned streams

Traits§

ForkStream
Extension trait to make any Stream cloneable.

Type Aliases§

Result