futures_lite::stream

Function once

source
pub fn once<T>(t: T) -> Once<T>
Expand description

Creates a stream that yields a single item.

ยงExamples

use futures_lite::stream::{self, StreamExt};

let mut s = stream::once(7);

assert_eq!(s.next().await, Some(7));
assert_eq!(s.next().await, None);