pub fn iter<I>(iter: I) -> Iter<<I as IntoIterator>::IntoIter> where
I: IntoIterator,
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);