Function tokio::stream::pending[][src]

pub const fn pending<T>() -> Pending<T>

Creates a stream that is never ready

The returned stream is never ready. Attempting to call next() will never complete. Use stream::empty() to obtain a stream that is is immediately empty but returns no values.

Examples

Basic usage:

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

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

    // This will never complete
    never.next().await;

    unreachable!();
}