pub fn once_future<F>(future: F) -> OnceFuture<F>
where F: Future,
Expand description

Creates a stream that invokes the given future as its first item, and then produces no more items.

§Example

use futures_lite::{stream, prelude::*};

let mut stream = Box::pin(stream::once_future(async { 1 }));
assert_eq!(stream.next().await, Some(1));
assert_eq!(stream.next().await, None);