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