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