Function tokio_stream::empty

source ·
pub const fn empty<T>() -> Empty<T>
Expand description

Creates a stream that yields nothing.

The returned stream is immediately ready and returns None. Use stream::pending() to obtain a stream that is never ready.

§Examples

Basic usage:

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

#[tokio::main]
async fn main() {
    let mut none = stream::empty::<i32>();

    assert_eq!(None, none.next().await);
}