tokio_stream

Function pending

Source
pub const fn pending<T>() -> Pending<T>
Expand description

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

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

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

    unreachable!();
}