Function futures::stream::once [−][src]
pub fn once<Fut>(future: Fut) -> Once<Fut> where
Fut: Future,
Creates a stream of single element
use futures::prelude::*; use futures::future; use futures::executor::block_on; use futures::stream; let mut stream = stream::once(future::ready(17)); let collected = block_on(stream.collect::<Vec<i32>>()); assert_eq!(collected, vec![17]);