Skip to main content

IterStream

Trait IterStream 

Source
pub trait IterStream<I: IntoIterator + Send> {
    // Required methods
    fn stream(self) -> impl Stream<Item = <I as IntoIterator>::Item> + Send;
    fn try_stream(
        self,
    ) -> impl TryStream<Ok = <I as IntoIterator>::Item, Error = Error, Item = Result<<I as IntoIterator>::Item, Error>> + Send;
}
Expand description

Converts synchronous iterables into immediately ready streams.

Source iteration order is preserved. The fallible form wraps each item in a successful result using the crate’s error type.

Required Methods§

Source

fn stream(self) -> impl Stream<Item = <I as IntoIterator>::Item> + Send

Converts the iterable into a stream of its items.

Items are yielded in the source iterator’s order. Polling requires no asynchronous work beyond advancing that iterator.

Source

fn try_stream( self, ) -> impl TryStream<Ok = <I as IntoIterator>::Item, Error = Error, Item = Result<<I as IntoIterator>::Item, Error>> + Send

Converts the iterable into a stream of successful results.

Every source item is wrapped in Ok with Error as the error type. The adapter itself never produces an error.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<I> IterStream<I> for I