Module futures_lite::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§

Traits§

Functions§

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

Type Aliases§

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