Function empty

fn empty() -> Empty

Constructs a new handle to an empty reader.

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

Examples

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

# futures::executor::block_on(async {
use futures::io::{self, AsyncReadExt};

let mut buffer = String::new();
let mut reader = io::empty();
reader.read_to_string(&mut buffer).await?;
assert!(buffer.is_empty());
# Ok::<(), Box<dyn std::error::Error>>(()) }).unwrap();