futures_lite::stream

Function 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);