Trait jstream_ext::JStreamExt[][src]

pub trait JStreamExt: Stream + Sized {
    fn dedup(self) -> DedupStream<Self>
    where
        Self::Item: Hash
, { ... }
fn fold_mut<T, F, Fut>(
        self,
        initial: T,
        handler: F
    ) -> FoldMut<Self, T, F, Fut>

Notable traits for FoldMut<S, T, F, Fut>

impl<S, T, F, Fut> Future for FoldMut<S, T, F, Fut> where
    S: Stream + FusedStream,
    F: FnMut(&mut T, S::Item) -> Fut,
    Fut: Future<Output = ()>, 
type Output = T;

    where
        Self: FusedStream,
        F: FnMut(&mut T, Self::Item) -> Fut,
        Fut: Future<Output = ()>
, { ... }
fn first(self) -> StreamNth<Self>

Notable traits for StreamNth<S>

impl<S> Future for StreamNth<S> where
    S: Stream, 
type Output = S::Item;
{ ... }
fn nth(self, index: usize) -> StreamNth<Self>

Notable traits for StreamNth<S>

impl<S> Future for StreamNth<S> where
    S: Stream, 
type Output = S::Item;
{ ... } }

Extensions to the Stream type which aren't already covered in StreamExt.

This is implemented using a blanket impl for all Stream implementors.

Provided methods

fn dedup(self) -> DedupStream<Self> where
    Self::Item: Hash
[src]

Given some stream where the item is Hash, return a stream which only emits the unique items emitted by the source stream.

You can think of this as "de-duplicating" this stream. Only the first instance of every unique item will be emitted.

This is implemented by computing and storing the hash (a u64 value) in a HashSet for each item emitted by the stream.

fn fold_mut<T, F, Fut>(self, initial: T, handler: F) -> FoldMut<Self, T, F, Fut>

Notable traits for FoldMut<S, T, F, Fut>

impl<S, T, F, Fut> Future for FoldMut<S, T, F, Fut> where
    S: Stream + FusedStream,
    F: FnMut(&mut T, S::Item) -> Fut,
    Fut: Future<Output = ()>, 
type Output = T;
where
    Self: FusedStream,
    F: FnMut(&mut T, Self::Item) -> Fut,
    Fut: Future<Output = ()>, 
[src]

fold, but with mutable references.

Turns this stream into a Future<Output=T>. You must provide some initial value of type T, and some function which accepts &mut T and Self::Item and returns Future<Output=()>.

After all items are emitted by this stream, the current value of T is emitted by the returned future.

If the stream emits no values, then the initial value of T is emitted.

fn first(self) -> StreamNth<Self>

Notable traits for StreamNth<S>

impl<S> Future for StreamNth<S> where
    S: Stream, 
type Output = S::Item;
[src]

Turn this Stream into a Future which gives the first item emitted by this stream (in the form of an Option, because the stream doesn't necessarily have to emit anything).

fn nth(self, index: usize) -> StreamNth<Self>

Notable traits for StreamNth<S>

impl<S> Future for StreamNth<S> where
    S: Stream, 
type Output = S::Item;
[src]

Turn this Stream into a Future which gives the nth item emitted by this stream (in the form of an Option, because the stream doesn't have to emit enough items to reach the index n).

It will only emit exactly the n'th item. If the stream completes before the nth item is reached, then the future will emit a value of None.

Loading content...

Implementors

impl<T> JStreamExt for T where
    T: Stream + Sized
[src]

Loading content...