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