Skip to main content

StreamSource

Trait StreamSource 

Source
pub trait StreamSource {
    type Item;

    // Required method
    fn next_item(&mut self) -> Option<Self::Item>;
}
Expand description

The dyn-compatible core trait for streams.

Implement this for any type that produces a sequence of values. Unlike Stream (which requires Self: Sized), StreamSource can be used as a trait object (Box<dyn StreamSource<Item = T>>).

Required Associated Types§

Source

type Item

The type of items produced.

Required Methods§

Source

fn next_item(&mut self) -> Option<Self::Item>

Advance the stream and return the next item, or None when exhausted.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§