[][src]Function smol::stream::block_on

pub fn block_on<S>(stream: S) -> BlockOn<S>

Notable traits for BlockOn<S>

impl<S> Iterator for BlockOn<S> where
    S: Unpin + Stream
type Item = <S as Stream>::Item;
where
    S: Unpin + Stream

Converts a stream into a blocking iterator.

Examples

use futures_lite::*;

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