Function futures_lite::stream::block_on

source ·
pub fn block_on<S: Stream + Unpin>(stream: S) -> BlockOn<S> 
Expand description

Converts a stream into a blocking iterator.

§Examples

use futures_lite::{pin, stream};

let stream = stream::once(7);
pin!(stream);

let mut iter = stream::block_on(stream);
assert_eq!(iter.next(), Some(7));
assert_eq!(iter.next(), None);