[][src]Function futures::stream::once

pub fn once<Fut>(future: Fut) -> Once<Fut> where
    Fut: Future

Creates a stream of single element

#![feature(async_await)]
use futures::future;
use futures::stream::{self, StreamExt};

let mut stream = stream::once(future::ready(17));
let collected = stream.collect::<Vec<i32>>().await;
assert_eq!(collected, vec![17]);