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§
Sourcefn metadata(&self) -> &StreamMetadata
fn metadata(&self) -> &StreamMetadata
Returns the metadata describing this node’s output stream.
Sourcefn next_packet(&self) -> Result<Option<StreamItem>>
fn next_packet(&self) -> Result<Option<StreamItem>>
Pulls the next packet, or Ok(None) when no packet is available yet.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".