Function async_std::stream::from_iter

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

Converts an iterator into a stream.

Examples

use async_std::prelude::*;
use async_std::stream;

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

assert_eq!(s.next().await, Some(0));
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);