Function tokio::io::empty[][src]

pub fn empty() -> Empty
Expand description

Creates a new empty async reader.

All reads from the returned reader will return Poll::Ready(Ok(0)).

This is an asynchronous version of std::io::empty.

Examples

A slightly sad example of not reading anything into a buffer:

use tokio::io::{self, AsyncReadExt};

#[tokio::main]
async fn main() {
    let mut buffer = String::new();
    io::empty().read_to_string(&mut buffer).await.unwrap();
    assert!(buffer.is_empty());
}