Function futures_util::stream::once [−][src]
pub fn once<Fut: Future>(future: Fut) -> Once<Fut>
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]);