pub fn empty() -> Empty
Available on crate feature
io
only.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());