[][src]Function smol::stream::iter

pub fn iter<I>(iter: I) -> Iter<<I as IntoIterator>::IntoIter> where
    I: IntoIterator

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