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, StreamExt};

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

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