Skip to main content

OptionStream

Trait OptionStream 

Source
pub trait OptionStream<T> {
    // Required method
    fn stream(self) -> impl Stream<Item = T> + Send;
}
Expand description

Converts an optional future of initial and trailing items into a stream.

A present future yields its iterable items before chaining its trailing stream. An absent future becomes an empty stream.

Required Methods§

Source

fn stream(self) -> impl Stream<Item = T> + Send

Flattens the optional future into one ordered stream.

Items from the returned iterable are emitted before the accompanying stream is polled. No items are emitted when the optional future is absent.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<T, O, S, Fut> OptionStream<T> for OptionFuture<Fut>
where Fut: Future<Output = (O, S)> + Send, S: Stream<Item = T> + Send, O: IntoIterator<Item = T> + Send, <O as IntoIterator>::IntoIter: Send, T: Send,

Source§

fn stream(self) -> impl Stream<Item = T> + Send

Implementors§