Function async_std::stream::once[][src]

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

Creates a stream that yields a single item.

Examples

use async_std::prelude::*;
use async_std::stream;

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

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