futures_util::io

Function empty

source
pub fn empty() -> Empty
Expand description

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:

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());