pub trait StreamTools: Stream {
    // Provided methods
    fn fast_forward(self) -> FastForward<Self>
       where Self: Sized { ... }
    fn flatten_switch(self) -> FlattenSwitch<Self>
       where Self::Item: Stream,
             Self: Sized { ... }
    fn sample<S: Stream>(self, sampler: S) -> Sample<Self, S>
       where Self: Sized { ... }
}
Expand description

An extension trait for the Stream trait that provides a variety of convenient combinator functions.

Provided Methods§

source

fn fast_forward(self) -> FastForward<Self>where Self: Sized,

Fast-forwards to the latest value on the underlying stream by polling the underyling until it is Pending.

When the underlying stream terminates, this stream will yield the last value on the underlying stream, if it has not already been yielded.

This behaves like a WatchStream but can be applied to arbitrary streams without requiring a channel.

source

fn flatten_switch(self) -> FlattenSwitch<Self>where Self::Item: Stream, Self: Sized,

Flattens a stream of streams into just one continuous stream. Polls only the latest inner stream.

The stream terminates when the outer stream terminates.

This mirrors the behaviour of the Switch operator in ReactiveX.

source

fn sample<S: Stream>(self, sampler: S) -> Sample<Self, S>where Self: Sized,

Samples values from the stream when the sampler yields.

The stream terminates when either the input stream or the sampler stream terminate.

This mirrors the behaviour of the Sample operator in ReactiveX.

Implementors§

source§

impl<T: Stream> StreamTools for T