Module stream

Source
Expand description

Combinators for the Stream trait.

§Examples

use futures_lite::stream::{self, StreamExt};

let mut s = stream::iter(vec![1, 2, 3]);

assert_eq!(s.next().await, Some(1));
assert_eq!(s.next().await, Some(2));
assert_eq!(s.next().await, Some(3));
assert_eq!(s.next().await, None);

Re-exports§

pub use futures_core::stream::Stream;

Structs§

AllFuture
Future for the StreamExt::all() method.
AnyFuture
Future for the StreamExt::any() method.
BlockOn
Iterator for the block_on() function.
Chain
Stream for the StreamExt::chain() method.
Cloned
Stream for the StreamExt::cloned() method.
CollectFuture
Future for the StreamExt::collect() method.
Copied
Stream for the StreamExt::copied() method.
CountFuture
Future for the StreamExt::count() method.
Cycle
Stream for the StreamExt::cycle() method.
Empty
Stream for the empty() function.
Enumerate
Stream for the StreamExt::cycle() method.
Filter
Stream for the StreamExt::filter() method.
FilterMap
Stream for the StreamExt::filter_map() method.
FindFuture
Future for the StreamExt::find() method.
FindMapFuture
Future for the StreamExt::find_map() method.
FlatMap
Stream for the StreamExt::flat_map() method.
Flatten
Stream for the StreamExt::flat_map() method.
FoldFuture
Future for the StreamExt::fold() method.
ForEachFuture
Future for the StreamExt::for_each() method.
Fuse
Stream for the StreamExt::fuse() method.
Inspect
Stream for the StreamExt::inspect() method.
Iter
Stream for the iter() function.
LastFuture
Future for the StreamExt::last() method.
Map
Stream for the StreamExt::map() method.
NextFuture
Future for the StreamExt::next() method.
NthFuture
Future for the StreamExt::nth() method.
Once
Stream for the once() function.
Or
Stream for the or() function and the StreamExt::or() method.
PartitionFuture
Future for the StreamExt::partition() method.
Pending
Stream for the pending() function.
PollFn
Stream for the poll_fn() function.
PositionFuture
Future for the StreamExt::position() method.
Race
Stream for the race() function and the StreamExt::race() method.
Repeat
Stream for the repeat() function.
RepeatWith
Stream for the repeat_with() function.
Scan
Stream for the StreamExt::scan() method.
Skip
Stream for the StreamExt::skip() method.
SkipWhile
Stream for the StreamExt::skip_while() method.
StepBy
Stream for the StreamExt::step_by() method.
Take
Stream for the StreamExt::take() method.
TakeWhile
Stream for the StreamExt::take_while() method.
Then
Stream for the StreamExt::then() method.
TryCollectFuture
Future for the StreamExt::try_collect() method.
TryFoldFuture
Future for the StreamExt::try_fold() method.
TryForEachFuture
Future for the StreamExt::try_for_each() method.
TryNextFuture
Future for the StreamExt::try_next() method.
TryUnfold
Stream for the try_unfold() function.
Unfold
Stream for the unfold() function.
UnzipFuture
Future for the StreamExt::unzip() method.
Zip
Stream for the StreamExt::zip() method.

Traits§

StreamExt
Extension trait for Stream.

Functions§

block_on
Converts a stream into a blocking iterator.
empty
Creates an empty stream.
iter
Creates a stream from an iterator.
once
Creates a stream that yields a single item.
or
Merges two streams, preferring items from stream1 whenever both streams are ready.
pending
Creates a stream that is always pending.
poll_fn
Creates a stream from a function returning Poll.
race
Merges two streams, with no preference for either stream when both are ready.
repeat
Creates an infinite stream that yields the same item repeatedly.
repeat_with
Creates an infinite stream from a closure that generates items.
try_unfold
Creates a stream from a seed value and a fallible async closure operating on it.
unfold
Creates a stream from a seed value and an async closure operating on it.

Type Aliases§

Boxed
Type alias for Pin<Box<dyn Stream<Item = T> + Send + 'static>>.
BoxedLocal
Type alias for Pin<Box<dyn Stream<Item = T> + 'static>>.