[][src]Trait heim_common::prelude::StreamExt

pub trait StreamExt: Stream {
    default fn enumerate(self) -> Enumerate<Self> { ... }
}

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

Currently, there are only timeout and [throttle] functions, but this will increase over time.

Users are not expected to implement this trait. All types that implement Stream already implement StreamExt.

This trait can be imported directly or via the Tokio prelude: use tokio::prelude::*.

Provided methods

default fn enumerate(self) -> Enumerate<Self>

Creates a new stream which gives the current iteration count as well as the next value.

The stream returned yields pairs (i, val), where i is the current index of iteration and val is the value returned by the iterator.

Overflow Behavior

The method does no guarding against overflows, so counting elements of an iterator with more than std::usize::MAX elements either produces the wrong result or panics.

Loading content...

Implementors

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

default fn enumerate(self) -> Enumerate<Self>[src]

Loading content...