Skip to main content

once_raw

Function once_raw 

Source
pub fn once_raw<T>(value: T) -> Once<T>
Expand description

Re-export of tokio_stream utilities; Creates a stream that emits an element exactly once.

The returned stream is immediately ready and emits the provided value once.

ยงExamples

use tokio_stream::{self as stream, StreamExt};

// one is the loneliest number
let mut one = stream::once(1);

assert_eq!(Some(1), one.next().await);

// just one, that's all we get
assert_eq!(None, one.next().await);