[][src]Module async_std::stream

Composable asynchronous iteration.

This module is an async version of std::iter.

Examples

use async_std::prelude::*;
use async_std::stream;

let mut s = stream::repeat(9).take(3);

while let Some(v) = s.next().await {
    assert_eq!(v, 9);
}

Structs

Chain

Chains two streams one after another.

Empty

A stream that doesn't yield any items.

Filter

A stream to filter elements of another stream with a predicate.

FromFn

A stream that yields elements by calling a closure.

Fuse

A Stream that is permanently closed once a single call to poll results in Poll::Ready(None), returning Poll::Ready(None) for all future calls to poll.

Inspect

A stream that does something with each element of another stream.

Intervalunstable

A stream representing notifications at fixed interval

Mergeunstable

A stream that merges two other streams into a single stream.

Once

A stream that yields a single item.

Repeat

A stream that yields the same item repeatedly.

RepeatWith

A stream that repeats elements of type T endlessly by applying a provided closure.

Scan

A stream to maintain state while polling another stream.

Skip

A stream to skip first n elements of another stream.

SkipWhile

A stream to skip elements of another stream based on a predicate.

StepBy

A stream that steps a given amount of elements of another stream.

Take

A stream that yields the first n items of another stream.

TakeWhile

A stream that yields elements based on a predicate.

Zip

An iterator that iterates two other iterators simultaneously.

Traits

DoubleEndedStreamunstable

A stream able to yield elements from both ends.

ExactSizeStreamunstable

A stream that knows its exact length.

Extendunstable

Extend a collection with the contents of a stream.

FromStreamunstable

Conversion from a Stream.

FusedStreamunstable

A stream that always continues to yield None when exhausted.

IntoStreamunstable

Conversion into a Stream.

Productunstable

Trait to represent types that can be created by productming up a stream.

Stream

An asynchronous stream of values.

Sumunstable

Trait to represent types that can be created by summing up a stream.

Functions

empty

Creates a stream that doesn't yield any items.

from_fn

Creates a new stream where to produce each new element a provided closure is called.

intervalunstable

Creates a new stream that yields at a set interval.

once

Creates a stream that yields a single item.

repeat

Creates a stream that yields the same item repeatedly.

repeat_with

Creates a new stream that repeats elements of type A endlessly by applying the provided closure.