Function futures_lite::stream::iter

source ·
pub fn iter<I: IntoIterator>(iter: I) -> Iter<I::IntoIter>
Expand description

Creates a stream from an iterator.

Examples

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

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

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