Skip to main content

StreamNode

Trait StreamNode 

Source
pub trait StreamNode: Send + Sync {
    // Required methods
    fn metadata(&self) -> &StreamMetadata;
    fn next_packet(&self) -> Result<Option<StreamItem>>;
    fn is_done(&self) -> Result<bool>;
}
Expand description

Lazy source of stream packets backing a Stream.

A StreamNode is the pull-based engine behind a combinator: it exposes the stream metadata and yields one StreamItem at a time, advancing only when asked. Combinators wrap one or more upstream streams in their own node so that work is deferred until packets are actually pulled. Implementations are Send + Sync so a built graph can be shared across threads.

Required Methods§

Source

fn metadata(&self) -> &StreamMetadata

Returns the metadata describing this node’s output stream.

Source

fn next_packet(&self) -> Result<Option<StreamItem>>

Pulls the next packet, or Ok(None) when no packet is available yet.

Source

fn is_done(&self) -> Result<bool>

Reports whether the node has reached its terminal done state.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§