pub fn once<F>(item: F) -> Once<<F as IntoFuture>::Future>where
F: IntoFuture,
Expand description
Creates a stream of single element
use futures::prelude::*;
use futures::stream;
use futures_executor::block_on;
let mut stream = stream::once::<Result<(), _>>(Err(17));
let collected: Result<Vec<_>, _> = block_on(stream.collect());
assert_eq!(collected, Err(17));
let mut stream = stream::once::<Result<_, ()>>(Ok(92));
let collected: Result<Vec<_>, _> = block_on(stream.collect());
assert_eq!(collected, Ok(vec![92]));